pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Paul Jungwirth <pj@illuminatedcomputing.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Correct docs about partitions and EXCLUDE constraints
Date: Wed, 18 Jun 2025 11:25:20 -0700
Message-ID: <c955d292-b92d-42d1-a2a0-1ec6715a2546@illuminatedcomputing.com> (raw)

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              ~{:-)
pj@illuminatedcomputing.com

Attachments:

v1-0001-Correct-docs-about-partitions-and-EXCLUDE-constra.patch (text/x-patch, 1.6K) download From 9436f3bdfe301be9d31d48a8b47eb0e802b67152 Mon Sep 17 00:00:00 2001 From: "Paul A. Jungwirth" <pj@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 <pj@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

view thread (3+ messages)  latest in thread

Message-ID: <c955d292-b92d-42d1-a2a0-1ec6715a2546@illuminatedcomputing.com>
Permalink:  ../c955d292-b92d-42d1-a2a0-1ec6715a2546@illuminatedcomputing.com/
Also on:    postgresql.org/message-id/c955d292-b92d-42d1-a2a0-1ec6715a2546@illuminatedcomputing.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: pj@illuminatedcomputing.com
  Subject: Re: Correct docs about partitions and EXCLUDE constraints
  In-Reply-To: <c955d292-b92d-42d1-a2a0-1ec6715a2546@illuminatedcomputing.com>
  References: <c955d292-b92d-42d1-a2a0-1ec6715a2546@illuminatedcomputing.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox