Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 92D1F632CA1 for ; Wed, 16 Dec 2009 14:36:14 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 00917-08 for ; Wed, 16 Dec 2009 18:36:01 +0000 (UTC) X-Greylist: delayed 00:39:39.088602 by SQLgrey-1.7.6 Received: from mail-pz0-f201.google.com (mail-pz0-f201.google.com [209.85.222.201]) by mail.postgresql.org (Postfix) with ESMTP id 61CB8632B42 for ; Wed, 16 Dec 2009 14:36:03 -0400 (AST) Received: by pzk39 with SMTP id 39so858639pzk.15 for ; Wed, 16 Dec 2009 10:36:02 -0800 (PST) Received: by 10.141.2.14 with SMTP id e14mr926195rvi.100.1260984697937; Wed, 16 Dec 2009 09:31:37 -0800 (PST) Received: from ?140.107.155.112? (DHCP155112.FHCRC.ORG [140.107.155.112]) by mx.google.com with ESMTPS id 20sm836766pzk.9.2009.12.16.09.31.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 16 Dec 2009 09:31:37 -0800 (PST) Message-ID: <4B291979.9010601@labkey.com> Date: Wed, 16 Dec 2009 09:31:37 -0800 From: Britt Piehler User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: 8.3/8.4 SQL incompatibility? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/43 X-Sequence-Number: 33481 A generated query of ours broke on upgrade from PG 8.3.3 to 8.4.1 with the following error: ERROR: failed to find conversion function from unknown to character varying SQL state: XX000 I've narrowed it down to sub-selects in union clauses, as in the test script below, which runs successfully on 8.3.3, but fails on 8.4.1. To reproduce: CREATE TABLE temp.TestTable ( TestColumn VARCHAR(20) ); (SELECT A.TestColumn FROM (SELECT 'TestValue' AS TestColumn FROM temp.TestTable) A) UNION (SELECT B.TestColumn FROM (SELECT TestColumn FROM temp.TestTable) B); Adding an explicit VARCHAR cast to the 'TestValue' string literal fixes the issue. This is nearly identical to http://archives.postgresql.org/pgsql-hackers/2009-06/msg01356.php, but Tom's reply there says that query hasn't worked since 7.1, while my query worked in 8.3.3. Can anyone tell me if this is a known/expected incompatibility, or if this is a bug? Thanks, Britt