Re: [19] Proposal: function markers to indicate collation/ctype sensitivity - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [19] Proposal: function markers to indicate collation/ctype sensitivity
Date
Msg-id 6566f0cf-6f0b-462d-a260-693170b5aba3@eisentraut.org
Whole thread Raw
Responses Re: [19] Proposal: function markers to indicate collation/ctype sensitivity
Re: [19] Proposal: function markers to indicate collation/ctype sensitivity
List pgsql-hackers
On 04.06.25 05:22, Jeff Davis wrote:
> This proposal would add that dependency information, and importantly,
> would be careful about which dependency entries are required for
> particular expressions and which are not.

> Introduce three new options when creating or altering a function,
> operator or index AM: COLLATE, CTYPE, or EQUALITY, representing the
> operations that the object is sensitive to.

Yes, this has been on my todo list since the day collations were added, 
but for a different reason:  We should be able to detect a failed 
collation derivation at parse time.  This is according to the SQL 
standard, and also because it's arguably a better user experience.  But 
we don't do that, so we have to check it at run time, which is what all 
these errmsg("could not determine which collation to use for string 
comparison") checks are for.

The reason we don't do it at parse time is that we don't have the 
information which functions care about collations, which is exactly what 
you are proposing here to add.

In my mind, I had this project listed under "procollate", but feel free 
to use a different name.  But I would consider making this one setting 
with multiple values instead of multiple boolean settings.

I don't mean to say that you should implement the parse-time collation 
derivation check as well, but we should design the catalog metadata so 
that that is possible.



pgsql-hackers by date:

Previous
From: Nazir Bilal Yavuz
Date:
Subject: Update Windows CI Task Names: Server 2022 + VS 2022 Upgrade
Next
From: Peter Eisentraut
Date:
Subject: Re: [19] Proposal: function markers to indicate collation/ctype sensitivity