Re: How to pass around collation information - Mailing list pgsql-hackers

From Robert Haas
Subject Re: How to pass around collation information
Date
Msg-id AANLkTimrCVX3O_ug2GDGg9fJw5WOPfCGgikJb5MYSARw@mail.gmail.com
Whole thread Raw
In response to Re: How to pass around collation information  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: How to pass around collation information
List pgsql-hackers
On Fri, May 28, 2010 at 2:48 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> So while it's true that the collation is used by the operations (> and
>> ORDER BY), the information which collation to use comes with the data
>> values.  It's basically saying, a is in language "de", so sort it like
>> that unless told otherwise.  There is also an override syntax available,
>> like this:
>
>> SELECT * FROM test WHERE a COLLATE en > 'baz' ORDER BY b COLLATE sv;
>
> That seems fairly bizarre.  What does this mean:
>
>        WHERE a COLLATE en > b COLLATE de
>
> ?  If it's an error, why is this not an error
>
>        WHERE a COLLATE en > b
>
> if b is marked as COLLATE de in its table?

I think we need to think of the comparison operators as ternary, and
the COLLATE syntax applied to columns or present in queries as various
ways of setting defaults or explicit overrides for what the third
argument will end up being.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to pass around collation information
Next
From: Robert Haas
Date:
Subject: Re: functional call named notation clashes with SQL feature