Re: should check collations when creating partitioned index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: should check collations when creating partitioned index
Date: 2023-11-30 23:04:57
Message-ID: 529598.1701385497@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
>> Here is an updated patch that works as indicated above.
>>
>> The behavior if you try to create an index with mismatching collations
>> now is that it will skip over the column and complain at the end with
>> something like
>>
>> ERROR:  0A000: unique constraint on partitioned table must include all
>> partitioning columns
>> DETAIL:  UNIQUE constraint on table "t1" lacks column "b" which is part
>> of the partition key.
>>
>> which perhaps isn't intuitive, but I think it would be the same if you
>> somehow tried to build an index with different operator classes than the
>> partitioning.  I think these less-specific error messages are ok in such
>> edge cases.

> If there are no further comments on this patch version, I plan to go
> ahead and commit it soon.

Sorry for slow response --- I've been dealing with a little too much
$REAL_LIFE lately. Anyway, I'm content with the v2 patch. I see
that the existing code works a little harder than this to produce
an on-point error message for mismatching operator, but after
studying that I'm not totally convinced that it's ideal behavior
either. I think we can wait for some field complaints to see if
we need a better error message for mismatching collation, and
if so what the shape of the bad input is exactly.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-11-30 23:35:09 Re: PostgreSql: Canceled on conflict out to old pivot
Previous Message Heikki Linnakangas 2023-11-30 23:03:07 Re: Refactoring backend fork+exec code