pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: rep.dot.nop@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7644: Missing implicit types of Result and failing type-conversion
Date: Sat, 10 Nov 2012 10:20:24 -0500
Message-ID: <8891.1352560824@sss.pgh.pa.us> (raw)
In-Reply-To: <E1TWlLN-0001Kk-0p@wrigleys.postgresql.org>
References: <E1TWlLN-0001Kk-0p@wrigleys.postgresql.org>

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




view thread (5+ messages)  latest in thread

Message-ID: <8891.1352560824@sss.pgh.pa.us>
Permalink:  ../8891.1352560824@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8891.1352560824@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rep.dot.nop@gmail.com
  Subject: Re: BUG #7644: Missing implicit types of Result and failing type-conversion
  In-Reply-To: <8891.1352560824@sss.pgh.pa.us>
  References: <E1TWlLN-0001Kk-0p@wrigleys.postgresql.org> <8891.1352560824@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox