Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TXCrE-0000z2-O9 for pgsql-bugs@postgresql.org; Sat, 10 Nov 2012 15:20:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TXCrC-0000w8-Gx for pgsql-bugs@postgresql.org; Sat, 10 Nov 2012 15:20:28 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id qAAFKOxG008892; Sat, 10 Nov 2012 10:20:24 -0500 (EST) From: Tom Lane To: rep.dot.nop@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7644: Missing implicit types of Result and failing type-conversion In-reply-to: References: Comments: In-reply-to rep.dot.nop@gmail.com message dated "Fri, 09 Nov 2012 09:57:45 +0000" Date: Sat, 10 Nov 2012 10:20:24 -0500 Message-ID: <8891.1352560824@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201211/48 X-Sequence-Number: 34606 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