On 8/3/22 18:13, Ron wrote:
On 8/3/22 20:02, Adrian Klaver wrote:
On 8/3/22 17:30, Ron wrote:
AWS RDS Postgresql 12.10
And https://www.postgresql.org/docs/12/sql-set-constraints.html seems to
say that SET CONSTRAINTS can make DEFERRABLE FKs temporarily not
deferrable.
What's the point?
The way I think of it is:
1) CONSTRAINTS are something that is supposed to constrain an action.
2) Setting DEFERRABLE is a cheat code to push 1) out to the end of a
transaction by using INITIALLY DEFERRED.
3) If the constraint was created/altered to DEFERRABLE INITIALLY
DEFERRED the SET CONSTRAINTS IMMEDIATE unsets the cheat code in a given
transaction. Maybe for most cases you want the check done at the end of
the transaction, but in a specific case you need that check to happen
before another statement occurs prior to the end of the transaction.
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx