Re: Sorting regression of text function result since commit 586b98fdf1aae

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Sorting regression of text function result since commit 586b98fdf1aae
Date: 2023-12-11 20:43:12
Message-ID: 2311662.1702327392@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com> writes:
> It looks like since 586b98fdf1aae, the result type collation of "convert_from"
> is forced to "C", like the patch does for type "name", instead of the "default"
> collation for type "text".

Well, convert_from() inherits its result collation from the input,
per the normal rules for collation assignment [1].

> Looking at hints in the header comment of function "exprCollation", I poked
> around and found that the result collation wrongly follow the input collation
> in this case.

It's not "wrong", it's what the SQL standard requires.

> I couldn't find anything explaining this behavior in the changelog. It looks
> like a regression to me, but if this is actually expected, maybe this deserve
> some documentation patch?

The v12 release notes do say

Type name now behaves much like a domain over type text that has
default collation ā€œCā€.

You'd have similar results from an expression involving such a domain,
I believe.

I'm less than excited about patching the v12 release notes four
years later. Maybe, if this point had come up in a more timely
fashion, we'd have mentioned it --- but it's hardly possible to
cover every potential implication of such a change in the
release notes.

regards, tom lane

[1] https://www.postgresql.org/docs/current/collation.html#COLLATION-CONCEPTS

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2023-12-11 20:49:34 Re: unconstify()/unvolatize() vs g++/clang++
Previous Message Jehan-Guillaume de Rorthais 2023-12-11 20:09:51 Sorting regression of text function result since commit 586b98fdf1aae