pgsql-server/src backend/utils/adt/ri_triggers ...

From: wieck(at)postgresql(dot)org (Jan Wieck)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql-server/src backend/utils/adt/ri_triggers ...
Date: 2003-04-07 20:30:38
Message-ID: 20030407203038.45054475EC9@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

CVSROOT: /cvsroot
Module name: pgsql-server
Changes by: wieck(at)postgresql(dot)org 03/04/07 16:30:38

Modified files:
src/backend/utils/adt: ri_triggers.c
src/test/regress/expected: foreign_key.out

Log message:
Avoid primary key lookup (and lock) if foreign key does not change
on UPDATE.

This get's rid of the long standing annoyance that updating a row
that has foreign keys locks all the referenced rows even if the
foreign key values do not change.

The trick is to actually do a check identical to NO ACTION after an
eventually done UPDATE in the SET DEFAULT case. Since a SET DEFAULT
operation should have moved referencing rows to a new "home", a following
NO ACTION check can only fail if the column defaults of the referencing
table resulted in the key we actually deleted. Thanks to Stephan.

Jan

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Meskes 2003-04-08 12:34:25 pgsql-server/src/interfaces/ecpg ChangeLog com ...
Previous Message Tom Lane 2003-04-07 15:04:03 pgsql-server/src/backend/utils/adt timestamp.c