Re: [19] Proposal: function markers to indicate collation/ctype sensitivity

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [19] Proposal: function markers to indicate collation/ctype sensitivity
Date: 2025-06-05 08:12:18
Message-ID: 6566f0cf-6f0b-462d-a260-693170b5aba3@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-06-05 08:16:35 Re: [19] Proposal: function markers to indicate collation/ctype sensitivity
Previous Message Nazir Bilal Yavuz 2025-06-05 08:04:49 Update Windows CI Task Names: Server 2022 + VS 2022 Upgrade