]> granicus.if.org Git - postgresql/commit
Extend ALTER TABLE to allow Foreign Keys to be added without initial validation.
authorSimon Riggs <simon@2ndQuadrant.com>
Tue, 8 Feb 2011 12:23:20 +0000 (12:23 +0000)
committerSimon Riggs <simon@2ndQuadrant.com>
Tue, 8 Feb 2011 12:23:20 +0000 (12:23 +0000)
commit722bf7017bbe796decc79c1fde03e7a83dae9ada
tree94145fc7a78c140f753d856bae8edf54bcce93b3
parent7202ad7b8dd07864092be70287fe971ec72a3fbc
Extend ALTER TABLE to allow Foreign Keys to be added without initial validation.
FK constraints that are marked NOT VALID may later be VALIDATED, which uses an
ShareUpdateExclusiveLock on constraint table and RowShareLock on referenced
table. Significantly reduces lock strength and duration when adding FKs.
New state visible from psql.

Simon Riggs, with reviews from Marko Tiikkaja and Robert Haas
15 files changed:
doc/src/sgml/ref/alter_table.sgml
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/pg_constraint.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/parser/gram.y
src/backend/utils/adt/ri_triggers.c
src/bin/psql/describe.c
src/include/catalog/pg_constraint.h
src/include/nodes/parsenodes.h
src/include/parser/kwlist.h
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql