Re: Exclusion constraints on partitioned tables

Ronan Dunklau <ronan.dunklau@aiven.io>

From: Ronan Dunklau <ronan.dunklau@aiven.io>
To: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@lists.postgresql.org
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>, Paul Jungwirth <pj@illuminatedcomputing.com>
Date: 2023-01-24T14:38:13Z
Lists: pgsql-hackers
Le vendredi 16 décembre 2022, 06:11:49 CET Paul Jungwirth a écrit :
> On 12/15/22 16:12, Tom Lane wrote:
> >> This patch also requires the matching constraint columns to use equality
> >> comparisons (`(foo WITH =)`), so it is really equivalent to the existing
> >> b-tree rule.
> > 
> > That's not quite good enough: you'd better enforce that it's the same
> > equality operator (and same collation, if relevant) as is being used
> > in the partition key.
> > [snip]
> > It might work better to consider the operator itself and ask if
> > it's equality in the same btree opfamily that's used by the
> > partition key.
> 
> Thank you for taking a look! Here is a comparison on just the operator
> itself.
> 

I've taken a look at the patch, and I'm not sure why you keep the restriction 
on the Gist operator being of the RTEqualStrategyNumber strategy. I don't 
think  we have any other place where we expect those strategy numbers to 
match. For hash it's different, as the hash-equality is the only operator 
strategy and as such there is no other way to look at it. Can't we just 
enforce partition_operator == exclusion_operator without adding the 
RTEqualStrategyNumber for the opfamily into the mix ?








Commits

  1. Allow some exclusion constraints on partitions