Re: Bug in either collation docs or code - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: Bug in either collation docs or code
Date
Msg-id CAAKRu_YMSuiO3Frzo8_NL-Te71b8-wPQ44sUmrW4_a4sNaEiZw@mail.gmail.com
Whole thread Raw
In response to Re: Bug in either collation docs or code  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Bug in either collation docs or code
Re: Bug in either collation docs or code
List pgsql-hackers



IIRC this was an intentional decision, made on the grounds that we
can't tell whether the function/operator actually cares about having
a determinate collation or not, so we have to leave it to execution of
that function/operator to complain or not.

 
In this case, why treat implicit and explicit collation conflicts differently? A conflicting explicit collation will produce an error during planning, whereas a conflicting implicit collation will not produce an error until execution.

create table foo(a text COLLATE "es_ES");
create table bar(b text COLLATE "de_DE");
insert into foo values('a'), ('b'), ('c'), ('d');
insert into bar values('b'), ('c'), ('g'), ('h');

SELECT * FROM foo WHERE a > (SELECT b FROM bar LIMIT 1); -- error during execution
EXPLAIN SELECT * FROM foo WHERE a > (SELECT b FROM bar LIMIT 1); -- but no error during planning
EXPLAIN SELECT 'c' COLLATE "de_DE" > 'ç' COLLATE "es_ES"; -- error during planning

It seems like this would not allow the function/operator to decide if it cares about a determinate collation during execution, since it would already have errored out during planning.

--
Melanie Plageman

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Bug in either collation docs or code
Next
From: David Rowley
Date:
Subject: Re: why partition pruning doesn't work?