Обсуждение: pgsql: Change ON UPDATE SET NULL/SET DEFAULT referential actions to mee

Поиск
Список
Период
Сортировка

pgsql: Change ON UPDATE SET NULL/SET DEFAULT referential actions to mee

От
Tom Lane
Дата:
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/c75be2ad6013684f2c118eea3ad8498f8d129c59

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(-)