21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CREATE DOMAIN<br />

Available in: DSQL, ESQL<br />

Context variables as defaults<br />

Changed in: IB<br />

DDL statements<br />

DOMAIN<br />

Description: Any context variable that is assignment-compatible to the new domain's datatype can be used as a<br />

default. This was already the case in InterBase 6, but the <strong>Language</strong> <strong>Reference</strong> only mentioned USER.<br />

Example:<br />

create domain DDate as<br />

date<br />

default current_date<br />

not null<br />

ALTER DOMAIN<br />

Available in: DSQL, ESQL<br />

Warning<br />

If you change a domain's definition, existing PSQL code using that domain may become invalid. If this happens,<br />

the system table field RDB$VALID_BLR will be set to 0 for any procedure or trigger whose code is no longer<br />

valid. If you have changed a domain, the following query will find the code modules that depend on it and<br />

report the state of RDB$VALID_BLR:<br />

select * from (<br />

select 'Procedure', rdb$procedure_name, rdb$valid_blr from rdb$procedures<br />

union<br />

select 'Trigger', rdb$trigger_name, rdb$valid_blr from rdb$triggers<br />

) (type, name, valid)<br />

where exists<br />

(select * from rdb$dependencies<br />

where rdb$dependent_name = name and rdb$depended_on_name = 'MYDOMAIN')<br />

/* Replace MYDOMAIN with the actual domain name. Use all-caps if the domain<br />

was created case-insensitively. Otherwise, use the exact capitalisation. */<br />

Unfortunately, not all PSQL invalidations will be reflected in the RDB$VALID_BLR field. It is therefore advisable<br />

to look at all the procedures and triggers reported by the above query, even those having a 1 in the<br />

“VALID” column.<br />

21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!