Re: cast to domain with default collation issue.

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: cast to domain with default collation issue.
Date: 2022-05-25 07:19:11
Message-ID: CACJufxHEY81v1=h_OVgCJu9PU0yDUE-DxqWLYdTKJ8Z9ESjkWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

postgresql 15 manual parts:

Otherwise, all input expressions must have the same implicit collation
> derivation or the default collation. If any non-default collation is
> present, that is the result of the collation combination. Otherwise, the
> result is the default collation.
>

For example, consider this table definition:
>
> CREATE TABLE test1 (
> a text COLLATE "de_DE",
> b text COLLATE "es_ES",
> ...
> );
>
> Then in
>
> SELECT a < 'foo' FROM test1;
>
> the < comparison is performed according to de_DE rules, because the
> expression combines an implicitly derived collation with the default
> collation.
>
query: * SELECT a < 'foo' FROM test1;*
is an example of {{If any non-default collation is present, that is the
result of the collation combination. }}

So it should be something like {{ if any side of expression don't have
implicit derived collation is present, that is the result of the collation
combination}

I personally feel wording *non-default* may not be that correct. Because if
the column is text then it automatically at least has default collation.

see manual quote about default collation:

> The collation of an expression can be the “default” collation, which
> means the locale settings defined for the database. It is also possible for
> an expression's collation to be indeterminate. In such cases, ordering
> operations and other operations that need to know the collation will fail.
>

On Wed, May 25, 2022 at 12:08 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> Please don’t top-post.
>
> On Tuesday, May 24, 2022, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
>>
>> Otherwise, all input expressions must have the same implicit collation
>>> derivation or the default collation. If any non-default collation is
>>> present, that is the result of the collation combination. Otherwise, the
>>> result is the default collation.
>>>
>>
>> I think the above quote part can be used to explain the following
>> examples.
>>
>>> CREATE TABLE test1 ( a text COLLATE "de_DE", b text COLLATE "es_ES", c
>>> text );
>>> SELECT a < 'foo' FROM test1;
>>
>> SELECT c < 'foo' FROM test1;
>>
>> But the *non-default* seems not that correct for me. Like a column if it does not mention anything, then the default value is null. So
>> * create table test111( a tex*t) The default collation for column a is the same as the output of *show lc_collate*.
>>
>> so there is no *non-default? *
>>
>>
> I’m not following the point you are trying to make. table111.a
> contributes the default collation for any expression needing a collation
> implicitly resolved.
>
> David J.
>
>

--
I recommend David Deutsch's <<The Beginning of Infinity>>

Jian

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message jian he 2022-05-25 08:22:21 link that explain ICU_LOCALE locale concept about local variant code and keywords.
Previous Message operations i 2022-05-25 06:42:30 Re: How is this possible "publication does not exist"