aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2022-09-05 18:44:11 +1200
committerDavid Rowley <drowley@postgresql.org>2022-09-05 18:44:11 +1200
commita254545a54a2e14ec6f41b8190d6c6713a85a18a (patch)
treed52d081abeb6cd6ac1db4b9fc6e8b36738279738
parentbc73bd26f17f236368a0a3434e0c632d332803ca (diff)
downloadpostgresql-a254545a54a2e14ec6f41b8190d6c6713a85a18a.tar.gz
postgresql-a254545a54a2e14ec6f41b8190d6c6713a85a18a.zip
Doc: clarify partitioned table limitations
Improve documentation regarding the limitations of unique and primary key constraints on partitioned tables. The existing documentation didn't make it clear that the constraint columns had to be present in the partition key as bare columns. The reader could be led to believe that it was ok to include the constraint columns as part of a function call's parameters or as part of an expression. Additionally, the documentation didn't mention anything about the fact that we disallow unique and primary key constraints if the partition keys contain *any* function calls or expressions, regardless of if the constraint columns appear as columns elsewhere in the partition key. The confusion here was highlighted by a report on the general mailing list by James Vanns. Discussion: https://postgr.es/m/CAH7vdhNF0EdYZz3GLpgE3RSJLwWLhEk7A_fiKS9dPBT3Dz_3eA@mail.gmail.com Discussion: https://postgr.es/m/CAApHDvoU-u9iTqKjteYRFfi+UNEk7dbSAcyxEQD==vZt9B1KnA@mail.gmail.com Reviewed-by: Erik Rijkers Backpatch-through: 11
-rw-r--r--doc/src/sgml/ddl.sgml13
1 files changed, 7 insertions, 6 deletions
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index c85e92b3a2f..e49d19716c1 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -4057,12 +4057,13 @@ ALTER INDEX measurement_city_id_logdate_key
<itemizedlist>
<listitem>
<para>
- Unique constraints (and hence primary keys) on partitioned tables must
- include all the partition key columns. This limitation exists because
- the individual indexes making up the constraint can only directly
- enforce uniqueness within their own partitions; therefore, the
- partition structure itself must guarantee that there are not
- duplicates in different partitions.
+ To create a unique or primary key constraint on a partitioned table,
+ the partition keys must not include any expressions or function calls
+ and the constraint's columns must include all of the partition key
+ columns. This limitation exists because the individual indexes making
+ up the constraint can only directly enforce uniqueness within their own
+ partitions; therefore, the partition structure itself must guarantee
+ that there are not duplicates in different partitions.
</para>
</listitem>