Обсуждение: pgsql: Recast "ONLY" column CHECK constraints as NO INHERIT

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

pgsql: Recast "ONLY" column CHECK constraints as NO INHERIT

От
Alvaro Herrera
Дата:
Recast "ONLY" column CHECK constraints as NO INHERIT

The original syntax wasn't universally loved, and it didn't allow its
usage in CREATE TABLE, only ALTER TABLE.  It now works everywhere, and
it also allows using ALTER TABLE ONLY to add an uninherited CHECK
constraint, per discussion.

The pg_constraint column has accordingly been renamed connoinherit.

This commit partly reverts some of the changes in
61d81bd28dbec65a6b144e0cd3d0bfe25913c3ac, particularly some pg_dump and
psql bits, because now pg_get_constraintdef includes the necessary NO
INHERIT within the constraint definition.

Author: Nikhil Sontakke
Some tweaks by me

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/09ff76fcdb275769ac4d1a45a67416735613d04b

Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml          |    5 +-
doc/src/sgml/ref/create_table.sgml         |   14 ++++--
src/backend/catalog/heap.c                 |   35 ++++++++-------
src/backend/catalog/index.c                |    2 +-
src/backend/catalog/pg_constraint.c        |    4 +-
src/backend/commands/tablecmds.c           |   62 +++++++++++++---------------
src/backend/commands/trigger.c             |    2 +-
src/backend/nodes/copyfuncs.c              |    1 +
src/backend/nodes/equalfuncs.c             |    1 +
src/backend/nodes/outfuncs.c               |    1 +
src/backend/parser/gram.y                  |   18 +++++---
src/backend/utils/adt/ruleutils.c          |    9 +++-
src/backend/utils/cache/relcache.c         |    2 +-
src/bin/pg_dump/pg_dump.c                  |   39 +++++++-----------
src/bin/pg_dump/pg_dump.h                  |    1 -
src/bin/psql/describe.c                    |   20 +++------
src/include/access/tupdesc.h               |    2 +-
src/include/catalog/catversion.h           |    2 +-
src/include/catalog/heap.h                 |    6 +-
src/include/catalog/pg_constraint.h        |    4 +-
src/include/nodes/parsenodes.h             |    1 +
src/test/regress/expected/alter_table.out  |   10 ++--
src/test/regress/expected/inherit.out      |   14 +++---
src/test/regress/input/constraints.source  |   28 ++++++++++++
src/test/regress/output/constraints.source |   33 +++++++++++++++
src/test/regress/sql/alter_table.sql       |    6 +-
src/test/regress/sql/inherit.sql           |    8 ++--
27 files changed, 197 insertions(+), 133 deletions(-)


Re: pgsql: Recast "ONLY" column CHECK constraints as NO INHERIT

От
Thom Brown
Дата:
On 21 April 2012 03:57, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> Recast "ONLY" column CHECK constraints as NO INHERIT
>
> The original syntax wasn't universally loved, and it didn't allow its
> usage in CREATE TABLE, only ALTER TABLE.  It now works everywhere, and
> it also allows using ALTER TABLE ONLY to add an uninherited CHECK
> constraint, per discussion.
>
> The pg_constraint column has accordingly been renamed connoinherit.
>
> This commit partly reverts some of the changes in
> 61d81bd28dbec65a6b144e0cd3d0bfe25913c3ac, particularly some pg_dump and
> psql bits, because now pg_get_constraintdef includes the necessary NO
> INHERIT within the constraint definition.

A couple typos:

In doc/src/sgml/ref/alter_table.sgml:

s/explicitely/explicitly/


In doc/src/sgml/ref/create_table.sgml:

"A constraint marked with NO INHERIT will not propagate to children tables."

s/children/child/

--
Thom