1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Allow some exclusion constraints on partitions

Previously we only allowed unique B-tree constraints on partitions
(and only if the constraint included all the partition keys).  But we
could allow exclusion constraints with the same restriction.  We also
require that those columns be compared for equality, not something
like &&.

Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Ronan Dunklau <ronan.dunklau@aiven.io>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/ec8b1d9b-502e-d1f8-e909-1bf9dffe6fa5@illuminatedcomputing.com
This commit is contained in:
Peter Eisentraut
2023-07-12 09:24:43 +02:00
parent ce0b0fa3e7
commit 8c852ba9a4
13 changed files with 284 additions and 73 deletions

View File

@ -4216,11 +4216,13 @@ ALTER INDEX measurement_city_id_logdate_key
<listitem>
<para>
There is no way to create an exclusion constraint spanning the
whole partitioned table. It is only possible to put such a
constraint on each leaf partition individually. Again, this
limitation stems from not being able to enforce cross-partition
restrictions.
Similarly an exclusion constraint must include all the
partition key columns. Furthermore the constraint must compare those
columns for equality (not e.g. <literal>&amp;&amp;</literal>).
Again, this limitation stems from not being able to enforce
cross-partition restrictions. The constraint may include additional
columns that aren't part of the partition key, and it may compare
those with any operators you like.
</para>
</listitem>