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

pgsql: Extend ALTER TABLE to allow Foreign Keys to be added withoutini

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Extend ALTER TABLE to allow Foreign Keys to be added withoutini
Date: 2011-02-08 12:24:11
Message-ID: E1Pmmc7-000194-GY@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-hackers
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

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=722bf7017bbe796decc79c1fde03e7a83dae9ada

Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml         |   22 ++++++-
src/backend/catalog/heap.c                |    1 +
src/backend/catalog/index.c               |    1 +
src/backend/catalog/pg_constraint.c       |    2 +
src/backend/commands/tablecmds.c          |  105 +++++++++++++++++++++++++++--
src/backend/commands/trigger.c            |    1 +
src/backend/commands/typecmds.c           |    1 +
src/backend/parser/gram.y                 |   28 +++++++-
src/backend/utils/adt/ri_triggers.c       |    7 ++-
src/bin/psql/describe.c                   |    9 ++-
src/include/catalog/pg_constraint.h       |   40 ++++++-----
src/include/nodes/parsenodes.h            |    2 +
src/include/parser/kwlist.h               |    1 +
src/test/regress/expected/alter_table.out |   12 +++
src/test/regress/sql/alter_table.sql      |   15 ++++
15 files changed, 215 insertions(+), 32 deletions(-)

Responses

pgsql-hackers by date

Next:From: Itagaki TakahiroDate: 2011-02-08 12:25:29
Subject: Re: SQL/MED - file_fdw
Previous:From: Bruce MomjianDate: 2011-02-08 12:23:55
Subject: Re: SSI patch version 14

pgsql-committers by date

Next:From: Simon RiggsDate: 2011-02-08 14:53:05
Subject: pgsql: Remove rare corner case for data loss when triggering standbyse
Previous:From: Heikki LinnakangasDate: 2011-02-08 07:07:46
Subject: Re: [COMMITTERS] pgsql: Implement genuine serializable isolation level.

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