Skip site navigation (1) Skip section navigation (2)

pgsql: Change ON UPDATE SET NULL/SET DEFAULT referential actions tomee

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Change ON UPDATE SET NULL/SET DEFAULT referential actions tomee
Date: 2012-06-18 16:13:12
Message-ID: (view raw or whole thread)
Lists: pgsql-committers
Change ON UPDATE SET NULL/SET DEFAULT referential actions to meet SQL spec.

Previously, when executing an ON UPDATE SET NULL or SET DEFAULT action for
a multicolumn MATCH SIMPLE foreign key constraint, we would set only those
referencing columns corresponding to referenced columns that were changed.
This is what the SQL92 standard said to do --- but more recent versions
of the standard say that all referencing columns should be set to null or
their default values, no matter exactly which referenced columns changed.
At least for SET DEFAULT, that is clearly saner behavior.  It's somewhat
debatable whether it's an improvement for SET NULL, but it appears that
other RDBMS systems read the spec this way.  So let's do it like that.

This is a release-notable behavioral change, although considering that
our documentation already implied it was done this way, the lack of
complaints suggests few people use such cases.



Modified Files
doc/src/sgml/ddl.sgml                     |   37 ++++--
doc/src/sgml/ref/create_table.sgml        |   28 +++--
src/backend/utils/adt/ri_triggers.c       |  187 ++---------------------------
src/test/regress/expected/foreign_key.out |   32 +++---
src/test/regress/sql/foreign_key.sql      |    6 +-
5 files changed, 72 insertions(+), 218 deletions(-)

pgsql-committers by date

Next:From: Tom LaneDate: 2012-06-18 16:19:48
Subject: pgsql: Update SQL spec references in ri_triggers code to matchSQL:2008
Previous:From: Albe LaurenzDate: 2012-06-18 07:22:32
Subject: Re: [COMMITTERS] pgsql: New SQL functons pg_backup_in_progress() and pg_backup_start_tim

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group