Subject | Re: [firebird-support] Re: Poor selectivity in foreign keys |
---|---|
Author | Salvatore Besso |
Post date | 2004-10-16T09:22:04Z |
hello Helen,
as usual, thank you for your precious suggestions. Today I will try your
solution.
Ok, I think that this trigger could be omitted, since once assigned, the foreign
keys in the child tables never change, that's to say, once I have inserted a
row, for example, in LOG_TOTALS with that ID_ANAGRAPHIC as LOG_OWNER, LOG_OWNER
in LOG_TOTALS will never change, it could be only deleted, this is because there
is no direct access for the user to the child tables, that are updated
automatically only via triggers.
Thank you again.
Cheers
Salvatore
as usual, thank you for your precious suggestions. Today I will try your
solution.
> Or, if you want to cascade updates, write this:[snip]
>
> CREATE TRIGGER AU_ANAGRAPHICS FOR ANAGRAPHICS
> ACTIVE AFTER UPDATE
> AS
> BEGIN
> UPDATE LOG_TOTALS
> SET LOG_OWNER = NEW.ID_ANAGRAPHIC
> WHERE LOG_OWNER = OLD.ID_ANAGRAPHIC;
Ok, I think that this trigger could be omitted, since once assigned, the foreign
keys in the child tables never change, that's to say, once I have inserted a
row, for example, in LOG_TOTALS with that ID_ANAGRAPHIC as LOG_OWNER, LOG_OWNER
in LOG_TOTALS will never change, it could be only deleted, this is because there
is no direct access for the user to the child tables, that are updated
automatically only via triggers.
Thank you again.
Cheers
Salvatore