typedb
typedb copied to clipboard
An error message for providing a value of a wrong type is not specific enough
Description
If we try to assign ownership of an attribute with a value type of lengthy but provide the value as a string (in quotes), we will gate an error message about being unable to cast Long on class String. That is an implementation detail, that should probably be replaced by TypeQL related value type terminology.
The class 'Predicate.Constant.String' cannot be casted to 'Predicate.Constant.Long'.
Environment
- TypeDB distribution: Core
- TypeDB version: 2.25.7
- Environment: Mac
- Studio version: 2.25.8
- Other details:
Reproducible Steps
- Set up
- Execute
match
$p type person;
$person isa $p;
$f type file;
$file isa $f;
delete
$person isa person;
insert
$file has size-kb 33;
- Unexpected result
## Error> [CXN05] The transaction is closed because of the error(s):
[QRY01] Invalid Query Pattern: The class 'Predicate.Constant.String' cannot be casted to 'Predicate.Constant.Long'.
Expected result
## Error> [CXN05] The transaction is closed because of the error(s):
[QRY01] Invalid Query Pattern: The `size-kb` attribute has the value type of `long` and can't have a value of the `string` value type.
Additional information
Relevant logs from TypeDB or Driver:
15:25:46.769 [typedb-service::0] ERROR com.vaticle.typedb.core.server.TransactionService -- [QRY01] Invalid Query Pattern: The class 'Predicate.Constant.String' cannot be casted to 'Predicate.Constant.Long'.