Thread: pgsql: Allow CHECK constraints to be declared ONLY

pgsql: Allow CHECK constraints to be declared ONLY

From
Alvaro Herrera
Date:
Allow CHECK constraints to be declared ONLY

This makes them enforceable only on the parent table, not on children
tables.  This is useful in various situations, per discussion involving
people bitten by the restrictive behavior introduced in 8.4.

Message-Id:
8762mp93iw.fsf@comcast.net
CAFaPBrSMMpubkGf4zcRL_YL-AERUbYF_-ZNNYfb3CVwwEqc9TQ@mail.gmail.com

Authors: Nikhil Sontakke, Alex Hunsaker
Reviewed by Robert Haas and myself

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/61d81bd28dbec65a6b144e0cd3d0bfe25913c3ac

Modified Files
--------------
doc/src/sgml/catalogs.sgml                |   10 ++++++
doc/src/sgml/ref/alter_table.sgml         |    8 +++++
src/backend/catalog/heap.c                |   28 +++++++++++-----
src/backend/catalog/index.c               |    3 +-
src/backend/catalog/pg_constraint.c       |    4 ++-
src/backend/commands/tablecmds.c          |   50 ++++++++++++++++++++---------
src/backend/commands/trigger.c            |    3 +-
src/backend/commands/typecmds.c           |    3 +-
src/backend/utils/cache/relcache.c        |    1 +
src/bin/pg_dump/pg_dump.c                 |   44 +++++++++++++++++---------
src/bin/pg_dump/pg_dump.h                 |    1 +
src/bin/psql/describe.c                   |   19 ++++++++---
src/include/access/tupdesc.h              |    1 +
src/include/catalog/heap.h                |    4 ++-
src/include/catalog/pg_constraint.h       |   25 +++++++++------
src/test/regress/expected/alter_table.out |   21 ++++++------
src/test/regress/expected/inherit.out     |   35 ++++++++++++++++++++
src/test/regress/sql/alter_table.sql      |   15 ++++-----
src/test/regress/sql/inherit.sql          |   14 ++++++++
19 files changed, 211 insertions(+), 78 deletions(-)


Re: pgsql: Allow CHECK constraints to be declared ONLY

From
Tom Lane
Date:
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Allow CHECK constraints to be declared ONLY

Surely this commit should have included a catversion bump.

            regards, tom lane

Re: pgsql: Allow CHECK constraints to be declared ONLY

From
Alvaro Herrera
Date:
Excerpts from Tom Lane's message of lun dic 19 17:39:59 -0300 2011:
>
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > Allow CHECK constraints to be declared ONLY
>
> Surely this commit should have included a catversion bump.

Whoops, sorry, committed that too.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support