Subject | Re: FKs: distinction between RESTRICT and NO ACTION |
---|---|
Author | Adam |
Post date | 2005-01-21T21:09:56Z |
I never use no action or restrict, but I doubt they are equivalent.
To me, no action means do nothing if the parent key is changed.
Restrict means raise an exception if you try and change the parent
key and there is a child for it.
I always use on update cascade or on update set to null depending on
what I am doing.
Adam
--- In firebird-support@yahoogroups.com, Milan Babuskov <milanb@k...>
wrote:
To me, no action means do nothing if the parent key is changed.
Restrict means raise an exception if you try and change the parent
key and there is a child for it.
I always use on update cascade or on update set to null depending on
what I am doing.
Adam
--- In firebird-support@yahoogroups.com, Milan Babuskov <milanb@k...>
wrote:
> Hello all,foreign key like this:
>
> I came across and interesting issue. First version, I create
>tables there
> alter table TABLE2 add constraint FK_TABLE2_1
> foreign key ( x ) references TABLE1 ( x )
> on update NO ACTION;
>
> Second version:
>
> alter table TABLE2 add constraint FK_TABLE2_1
> foreign key ( x ) references TABLE1 ( x );
>
> The effect seems to be the same. However, when I query the system
> is a difference:ACTION' and in
>
> select r.rdb$constraint_name, c.rdb$update_rule
> from rdb$relation_constraints r, rdb$ref_constraints c
> where r.rdb$relation_name = 'TABLE2'
> and r.rdb$constraint_name = c.rdb$constraint_name
> and (r.rdb$constraint_type='FOREIGN KEY')
>
> In first case, for RDB$UPDATE_RULE column the value stored is 'NO
> second case it's 'RESTRICT'.
>
> Is RESTRICT equal to NO ACTION? Why do they exist?
>
> BTW, is the devel list more appropriate for this kind of questions?
>
> --
> Milan Babuskov
> http://fbexport.sourceforge.net
> http://www.flamerobin.org