Firebird 2.5 Language Reference → Firebird 2.5 Language Reference → Supplementary Information → The RDB$VALID_BLR Field |
Table of Contents
The field RDB$VALID_BLR was added to the system tables RDB$PROCEDURES and RDB$TRIGGERS in Firebird 2.1. Its purpose is to signal possible invalidation of a PSQL module after alteration of a domain or table column on which the module depends.RDB$VALID_BLR is set to 0 for any procedure or trigger whose code is made invalid by such a change.
In triggers and procedures, dependencies arise on the definitions of table columns accessed and also on any parameter or variable that has been defined in the module using the TYPE OF clause.
After the engine has altered any domain, including the implicit domains created internally behind column definitions and output parameters, the engine internally recompiles all of its dependencies.
Note | |
---|---|
In V.2.x these comprise procedures and triggers but not blocks coded in DML statements for run-time execution with EXECUTE BLOCK. Firebird 3 will encompass more module types (stored functions, packages). |
Any module that fails to recompile because of an incompatibility arising from a domain change is marked as invalid (“invalidated” by setting the RDB$VALID_BLR in its system record (in RDB$PROCEDURES or RDB$TRIGGERS, as appropriate) to zero.
Revalidation (setting RDB$VALID_BLR to 1) occurs when
The following query will find the modules that depend on a specific domain and report the state of their RDB$VALID_BLR fields:
SELECT * FROM ( SELECT 'Procedure', rdb$procedure_name, rdb$valid_blr FROM rdb$procedures UNION ALL SELECT 'Trigger', rdb$trigger_name, rdb$valid_blr FROM rdb$triggers ) (type, name, valid) WHERE EXISTS (SELECT * from rdb$dependencies WHERE rdb$dependent_name = name AND rdb$depended_on_name = 'MYDOMAIN') /* Replace MYDOMAIN with the actual domain name. Use all-caps if the domain was created case-insensitively. Otherwise, use the exact capitalisation. */
The following query will find the modules that depend on a specific table column and report the state of their RDB$VALID_BLR fields:
SELECT * FROM ( SELECT 'Procedure', rdb$procedure_name, rdb$valid_blr FROM rdb$procedures UNION ALL SELECT 'Trigger', rdb$trigger_name, rdb$valid_blr FROM rdb$triggers) (type, name, valid) WHERE EXISTS (SELECT * FROM rdb$dependencies WHERE rdb$dependent_name = name AND rdb$depended_on_name = 'MYTABLE' AND rdb$field_name = 'MYCOLUMN')
Important | |
---|---|
All PSQL invalidations caused by domain/column changes are reflected in the RDB$VALID_BLR field. However, other kinds of changes, such as the number of input or output parameters, called routines and so on, do not affect the validation field even though they potentially invalidate the module. A typical such scenario might be one of the following:
|
Other Notes | |
---|---|
|
Firebird 2.5 Language Reference → Firebird 2.5 Language Reference → Supplementary Information → The RDB$VALID_BLR Field |