Re: Does the POSITION() function takes into account the COLLATION... or not ?!?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pageorge(at)unice(dot)fr, Pg Docs <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Does the POSITION() function takes into account the COLLATION... or not ?!?
Date: 2022-02-16 16:18:46
Message-ID: 3324021.1645028326@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Tue, Feb 15, 2022 at 11:17 AM PG Doc comments form <
> noreply(at)postgresql(dot)org> wrote:
>> ==> up to here, this seems pretty enough to conclude that POSITION()
>> doesn't
>> care at all about COLLATION and always perform a byte search.

> How collations behave is documented, in particular:

> "A collation is either deterministic or nondeterministic. A deterministic
> collation uses deterministic comparisons, which means that it considers
> strings to be equal only if they consist of the same byte sequence."

Right. POSITION does indeed do bytewise search, which is a legal
implementation for any deterministic collation, but perhaps not
for a nondeterministic one. Thus, it throws a feature-not-supported
error if asked to use a nondeterministic collation. As you say,
this is far from the only function that acts that way.

regards, tom lane

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Jian He 2022-02-17 06:09:55 range data type size not mention in docs.
Previous Message David G. Johnston 2022-02-16 16:10:08 Re: Does the POSITION() function takes into account the COLLATION... or not ?!?