Jehan-Guillaume de Rorthais <jgdr@dalibo.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