8000 Doc: clarify partitioned table limitations · postgres/postgres@1630cad · GitHub
[go: up one dir, main page]

Skip to content

Commit 1630cad

Browse files
committed
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
1 parent 4dc98b4 commit 1630cad

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

doc/src/sgml/ddl.sgml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3436,12 +3436,13 @@ ALTER INDEX measurement_city_id_logdate_key
34363436
<itemizedlist>
34373437
<listitem>
34383438
<para>
3439-
Unique constraints (and hence primary keys) on partitioned tables must
3440-
include all the partition key columns. This limitation exists because
3441-
the individual indexes making up the constraint can only directly
3442-
enforce uniqueness within their own partitions; therefore, the
3443-
partition structure itself must guarantee that there are not
3444-
duplicates in different partitions.
3439+
To create a unique or primary key constraint on a partitioned table,
3440+
the partition keys must not include any expressions or function calls
3441+
and the constraint's columns must include all of the partition key
3442+
columns. This limitation exists because the individual indexes making
3443+
up the constraint can only directly enforce uniqueness within their own
3444+
partitions; therefore, the partition structure itself must guarantee
3445+
that there are not duplicates in different partitions.
34453446
</para>
34463447
</listitem>
34473448

0 commit comments

Comments
 (0)
0