typedb icon indicating copy to clipboard operation
typedb copied to clipboard

When re-defining an existing schema attribute type, user has to provide the value, which is inconsistent

Open JonThom opened this issue 3 years ago • 2 comments

Description

When re-defining an existing schema attribute type, user has to provide the value (string, long, etc) or else gets an error. This is inconsistent with existing roles played or related or attributes owned, which do not have to be explicitly re-defined.

Environment

  1. OS (where TypeDB server runs): Mac OS 10
  2. TypeDB version (and platform): TypeDB 2.6.0
  3. TypeDB client: console

Reproducible Steps

Let's say we have a schema with friendship defined thus:

define friendship sub relation,
  relates friend,
  plays happy-relation,
  owns start-date;

Later on, we want to update friendship, e.g. to make it abstract.

If the schema allows it (non-abstract types can't own abstract attributes or relate or play abstract roles), we can just write

define friendship sub relation, abstract;

without having to redefine the roles that friendship plays or relates, nor attributes that it owns. We only have to specify the new fact that it should be abstract.

But there is an exception to this!

If friendship were instead defined initially as an attribute inheriting from the root attribute type, e.g.

define friendship sub attribute, value string;

and we tried to redefine it later to make it abstract, we'd get

[TYW12] Invalid Type Write: The attribute type 'friendship' is missing a value type.

and would have to include value string or similar when re-defining it to make it work.

JonThom avatar Jan 18 '22 10:01 JonThom

Seems to be related to #6510.

dmitrii-ubskii avatar Jan 10 '23 14:01 dmitrii-ubskii

This is still valid, and a different issue to that fixed by #6790

krishnangovindraj avatar Jun 02 '23 08:06 krishnangovindraj