Subject Re: [firebird-support] FKs: distinction between RESTRICT and NO ACTION
Author Ann W. Harrison
Milan Babuskov wrote:

>
> Is RESTRICT equal to NO ACTION? Why do they exist?

For Firebird, I believe they are equivalent.

NO ACTION is the default. This corresponds to the SQL-89 version of
referential constraints, and returns an error if the result of the
operation would be inconsistent with the constraint.

As I understand it, the SQL Standard specifies that a constraint that
with an action of RESTRICT will be enforced first, before triggers. A
constraint that specifies NO ACTION - or provides no specific directions
as to what happens when the constraint is evaluated - is applied after
the before action triggers...

So, if you want to define triggers that delete the referencing rows, use
NO ACTION. At some point we're likely to tighten up the rules on
RESTRICT so those constraints are executed before any triggers.

Regards,


Ann