There is no rules to name generator, of course. Because generators does not have any relation to it's usage. When generator is being used in trigger or procedure, you can track dependencies in rdb$dependencies table.
But, during repair services for some databases, we found that generators may not have any understandable relation with table, trigger or procedure. Moreover, we couldn't compute any relation with generator and max of primary key value.
So, we decided that there must be some guides to name generators in InterBase/Firebird. For example, it can be gen_<table_name>_id. Otherwise, how else generator can be correlated with the table in this case?
Wednesday, May 28, 2008
Subscribe to:
Post Comments (Atom)
1 comment:
You could add a new field into RDB$RELATIONS. But maybe your backups would cry... :)
Forget the "_id" suffix. It adds nothing. It would only restrict yet more your (already limited) tables namespace.
We used "gen_" prefix for years and with good results for primary key generation. For another uses, we use another convention: 'gen_number_(whatever)' (E.g.: 'gen_number_invoice').
Also, we use:
- T for Domains
- E for Exceptions
- IDX_ for Indices
- STP_ for Procedures
- TRG_xy_ for triggers, where
x = (A)fter/(B)efore; and
y = (I)nsert/(U)pdate/(D)elete.
- V_ for views
(The triggers choice was before universal triggers. :) )
But now I think we should to short this yet more: "I_", "P_", "Txy_".
Regards,
F.D.Castel
Post a Comment