]> granicus.if.org Git - postgresql/commit - doc/src/sgml/ref/create_table.sgml
Allow UNIQUE indexes on partitioned tables
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Feb 2018 19:59:37 +0000 (16:59 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 19 Feb 2018 20:40:00 +0000 (17:40 -0300)
commiteb7ed3f3063401496e4aa4bd68fa33f0be31a72f
treec39b449716ed2a1c9fe20af363bdc049cf0b6a3e
parent524d64ea8e3e49b4fda41ff9b2f048b697384058
Allow UNIQUE indexes on partitioned tables

If we restrict unique constraints on partitioned tables so that they
must always include the partition key, then our standard approach to
unique indexes already works --- each unique key is forced to exist
within a single partition, so enforcing the unique restriction in each
index individually is enough to have it enforced globally.  Therefore we
can implement unique indexes on partitions by simply removing a few
restrictions (and adding others.)

Discussion: https://postgr.es/m/20171222212921.hi6hg6pem2w2t36z@alvherre.pgsql
Discussion: https://postgr.es/m/20171229230607.3iib6b62fn3uaf47@alvherre.pgsql
Reviewed-by: Simon Riggs, Jesper Pedersen, Peter Eisentraut, Jaime
Casanova, Amit Langote
27 files changed:
doc/src/sgml/ddl.sgml
doc/src/sgml/ref/alter_table.sgml
doc/src/sgml/ref/create_index.sgml
doc/src/sgml/ref/create_table.sgml
src/backend/bootstrap/bootparse.y
src/backend/catalog/index.c
src/backend/catalog/pg_constraint.c
src/backend/catalog/toasting.c
src/backend/commands/indexcmds.c
src/backend/commands/tablecmds.c
src/backend/parser/analyze.c
src/backend/parser/parse_utilcmd.c
src/backend/tcop/utility.c
src/bin/pg_dump/t/002_pg_dump.pl
src/include/catalog/index.h
src/include/catalog/pg_constraint_fn.h
src/include/commands/defrem.h
src/include/parser/parse_utilcmd.h
src/test/regress/expected/alter_table.out
src/test/regress/expected/create_index.out
src/test/regress/expected/create_table.out
src/test/regress/expected/indexing.out
src/test/regress/expected/insert_conflict.out
src/test/regress/sql/alter_table.sql
src/test/regress/sql/create_index.sql
src/test/regress/sql/create_table.sql
src/test/regress/sql/indexing.sql