Fix collate and null processing in package constants#9037
Conversation
| jrd_tra* transaction = dsqlScratch->getTransaction(); | ||
| thread_db* tdbb = JRD_get_thread_data(); | ||
| *desc = ConstantValue::getDesc(tdbb, transaction, m_fullName); | ||
| desc->setNullable(true); |
There was a problem hiding this comment.
Why is constant references always marked as nullable?
There was a problem hiding this comment.
To return NULL from the ReferenceNode, the nullable flag is requered. It would be nice to explicitly check the not null state of the field, but as I can see, it does not stored in RDB$FIELD. So I decied to put the nullable flag withou extra checks.
The not null clasue can only be used when the type is a domain:
create domain my_domain int not null;
create or alter package my_package as
begin
constant my_const my_domain = null;
end;But in this case an error will appear instanly:
Statement failed, SQLSTATE = 2F000
validation error for CAST, value "*** null ***"
-Error while parsing BLR value of the constant "PUBLIC"."MY_PACKAGE"."MY_CONST"
So, putting nullable flag in any case is safe
There was a problem hiding this comment.
Every other kind of expressions, include composed ones, do return nullable flag correctly. I see no reason for constants to flag nullable incorrectly.
There was a problem hiding this comment.
It would be nice to explicitly check the
not nullstate of the field, but as I can see, it does not stored in RDB$FIELD
RDB$FIELDS.RDB$NULL_FLAG ?
Fix Regression decribed in https://groups.google.com/g/firebird-devel/c/5ehuR18Wemk and https://groups.google.com/g/firebird-devel/c/kze2LTWaeco