Using domains in definition of computed fields
It seems it is not allowed to use domains as type for computed fields. The following test produces an error (Firebird 5.0.2 on Windows):
SQL> create domain var8 as varchar(8);
SQL>
SQL> create table test(
CON> id var8 primary key,
CON> f1 varchar(8) computed by (id),
CON> f2 computed by(id),
CON> f3 var8 computed by (id)
CON> );
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 5, column 10
-computed
It works with the generic data type and without type specification, but not with the domain. According to Mark Rotteveel on firebird-support,
The "problem" is that the grammar for computed columns uses
non_array_typewhere it probably should be usingdomain_or_non_array_type_name.
If there is a special reason for that, at least the documentation should be updated to say explicitly that domains are not allowed.
The "problem" is that the grammar for computed columns uses
non_array_typewhere it probably should be usingdomain_or_non_array_type_name.
Not simple as that.
The computed value/source is in RDB$FIELDS, not RDB$RELATION_FIELDS.
And a field cannot be based in another field.
@asfernandes So, do you suggest that the documentation should be fixed instead?
Currently it's not accepted, so it's better to document it if not already.