Re: BUG #7644: Missing implicit types of Result and failing type-conversion

From: "Bernhard Reutner-Fischer" <rep(dot)dot(dot)nop(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #7644: Missing implicit types of Result and failing type-conversion
Date: 2012-11-10 15:56:02
Message-ID: 13aeb08ee8b.3848.2760.rep.dot.nop@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 10 November 2012 16:20:24 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> rep(dot)dot(dot)nop(at)gmail(dot)com writes:
> > select distinct on (bug) bug
> > from (
> > select * from (select 'string one' AS bug from generate_series(0,1))
> > s1
> > UNION
> > select * from (select 'string two' bug from generate_series(0,0))
> > s2
> > ) x
> > ;
> > ERROR: could not determine which collation to use for string comparison
> > HINT: Use the COLLATE clause to set the collation explicitly.
>
> > What am i missing or doing wrong?
>
> Leaving out the cast. An undecorated string literal is not a constant
> of type text --- it is a constant of unknown type, and the parser will
> throw an error if the type can't be resolved from fairly-local context.
> (The same applies to NULL, btw.)

Fair enough but what about the failure for the case with the Result
that fails to merge? There I do have a cast but it fails on the Result
as opposed to a genera e_series(0,0):

select distinct on (bug) bug
from (
select * from (select 'string one'::text AS bug from
generate_series(0,1)) s1
UNION
select * from (select 'string two' bug ) s2

) x
;

Sent with AquaMail for Android
http://www.aqua-mail.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-11-10 15:58:51 Re: BUG #7644: Missing implicit types of Result and failing type-conversion
Previous Message Tom Lane 2012-11-10 15:20:24 Re: BUG #7644: Missing implicit types of Result and failing type-conversion