Re: BUG #7644: Missing implicit types of Result and failing type-conversion - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #7644: Missing implicit types of Result and failing type-conversion
Date
Msg-id 8891.1352560824@sss.pgh.pa.us
Whole thread Raw
In response to BUG #7644: Missing implicit types of Result and failing type-conversion  (rep.dot.nop@gmail.com)
Responses Re: BUG #7644: Missing implicit types of Result and failing type-conversion
List pgsql-bugs
rep.dot.nop@gmail.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.)

            regards, tom lane

pgsql-bugs by date:

Previous
From: rep.dot.nop@gmail.com
Date:
Subject: BUG #7644: Missing implicit types of Result and failing type-conversion
Next
From: Tom Lane
Date:
Subject: Re: BUG #7644: Missing implicit types of Result and failing type-conversion