Along with schemas, a new BLR code blr_default2 was introduced. In case the table schema (from which the default value is taken) does not match dsqlScratch->ddlSchema, the BLR code stores not only the default value itself but also the schema. Since dsqlScratch->ddlSchema inside a package is set to the package’s schema, the generated default values ignore the original schema and do not use it when generating BLR.
I would appreciate help and advice: is this actually necessary (and in what cases), or is it just a small optimization to reduce the length of the default value’s BLR code?
The problem appeared while merging the rowtype feature and schemas in the part related to package types and their default values. If the schema is not explicitly included in the BLR code of the default value, later an error occurs when resolving fields mentioned in the default expression against the fields declared in the package type, because without the schema the package type cannot be found.
My suggestion is to remove blr_default2 and use the old blr_default, while always writing the schema name in the default value.
Are there really complex cases where the explicit schema name could cause issues inside a default value?
That’s correct for blr_default, while blr_default2 also includes the schema.
In my implementation blr_default likewise refers to the package type name and its fields, but since packages can now also reside in schemas, I need to distinguish package type names within packages by schema.
And I would be grateful if you could answer the questions I asked.