pgsql: Extend ALTER TABLE to allow Foreign Keys to be added without ini

Lists: pgsql-committerspgsql-hackers
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 without ini
Date: 2011-02-08 12:24:11
Message-ID: E1Pmmc7-000194-GY@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-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(-)


From: Bernd Helmle <mailings(at)oopsware(dot)de>
To: Simon Riggs <simon(at)2ndQuadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Extend ALTER TABLE to allow Foreign Keys to be added without ini
Date: 2011-02-08 21:58:38
Message-ID: 6A719D1DE382A36D92E56C7A@amenophis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

--On 8. Februar 2011 12:24:11 +0000 Simon Riggs <simon(at)2ndQuadrant(dot)com>
wrote:

> 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.

Hi Simon,

It seems this commit misses updates to system catalogs documentation
regarding pg_constraint.conisvalidated.

Bernd


From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Bernd Helmle <mailings(at)oopsware(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Extend ALTER TABLE to allow Foreign Keys to be added without ini
Date: 2011-02-08 23:00:03
Message-ID: 1297206003.1770.9113.camel@ebony
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers pgsql-hackers

On Tue, 2011-02-08 at 22:58 +0100, Bernd Helmle wrote:
>
> --On 8. Februar 2011 12:24:11 +0000 Simon Riggs <simon(at)2ndQuadrant(dot)com>
> wrote:
>
> > 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.
>
> Hi Simon,
>
> It seems this commit misses updates to system catalogs documentation
> regarding pg_constraint.conisvalidated.

So it does. Thanks I will rectify.

--
Simon Riggs http://www.2ndQuadrant.com/books/
PostgreSQL Development, 24x7 Support, Training and Services