Re: cast to domain with default collation issue.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: cast to domain with default collation issue.
Date: 2022-06-09 22:44:08
Message-ID: CAKFQuwYG1tfmo=Y-Qg0fh9jmtGsW59p_BbypDbHMFZiYdKm_ag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 24, 2022 at 7:42 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> I wrote:
> > Perhaps this should be documented more clearly, but it's not obviously
> > wrong. If the domain declaration doesn't include an explicit COLLATE
> > then casting to the domain doesn't create an explicit collation
> > requirement. (That is, the domain *doesn't* have a specific
> > collation attached to it, any more than type text does.)
>
> Perhaps we could improve matters like this?
>
> diff --git a/doc/src/sgml/ref/create_domain.sgml
> b/doc/src/sgml/ref/create_domain.sgml
> index 81a8924926..e4b856d630 100644
> --- a/doc/src/sgml/ref/create_domain.sgml
> +++ b/doc/src/sgml/ref/create_domain.sgml
> @@ -94,7 +94,8 @@ CREATE DOMAIN <replaceable
> class="parameter">name</replaceable> [ AS ] <replacea
> <listitem>
> <para>
> An optional collation for the domain. If no collation is
> - specified, the underlying data type's default collation is used.
> + specified, the domain has the same collation behavior as its
> + underlying data type.
> The underlying type must be collatable if
> <literal>COLLATE</literal>
> is specified.
> </para>
>
>
+1

The lack of any explicitness pushes evaluation down to the base type -
which is a behavioral thing as opposed to some kind of attribute it
possesses.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2022-06-09 23:09:59 Re: Row level security insert policy does not validate update new values/content?
Previous Message Steve Midgley 2022-06-09 19:16:12 Re: A function to find errors in groups in a table