Hi Hackers,

In pg17 we added support for cross-partition EXCLUDE constraints, as long as they included all partition key columns and compared them with equality (see 8c852ba9a4). I updated the docs for exclusion constraints, but I missed that the docs for CREATE TABLE still said that they were not supported. This commit fixes that. I don't see a similar message in the ALTER TABLE docs.

I take it we should apply this patch to both v18 and v17?

Yours,

--
Paul              ~{:-)
p...@illuminatedcomputing.com
From 9436f3bdfe301be9d31d48a8b47eb0e802b67152 Mon Sep 17 00:00:00 2001
From: "Paul A. Jungwirth" <p...@illuminatedcomputing.com>
Date: Tue, 17 Jun 2025 20:48:56 -0700
Subject: [PATCH v1] Correct docs about partitions and EXCLUDE constraints

In pg17 we added support for cross-partition EXCLUDE constraints, as
long as they included all partition key columns and compared them with
equality (see 8c852ba9a4347c4778cc610ad5a9cb50ea701b5c). I updated the
docs for exclusion constraints, but I missed that the docs for CREATE
TABLE still said that they were not supported. This commit fixes that.

Author: Paul A. Jungwirth <p...@illuminatedcomputing.com>
---
 doc/src/sgml/ref/create_table.sgml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index 4a41b2f5530..62eb273236b 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -448,8 +448,11 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
      </para>
 
      <para>
-      Partitioned tables do not support <literal>EXCLUDE</literal> constraints;
-      however, you can define these constraints on individual partitions.
+      Partitioned tables support <literal>EXCLUDE</literal> constraints
+      if the constraint includes all the partition key columns
+      and it compares all those columns for equality. It may include additional
+      columns and compare them however it likes (e.g. with <literal>&amp;&amp;</literal>).
+      This ensures that any rows that might conflict will fall in the same partition.
      </para>
 
      <para>
-- 
2.39.5

Reply via email to