Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B66601337B93 for ; Wed, 13 Apr 2011 20:03:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 72002-02 for ; Wed, 13 Apr 2011 23:03:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 1746D1337B8B for ; Wed, 13 Apr 2011 20:03:13 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Wed, 13 Apr 2011 18:03:03 -0500 Message-Id: <4DA5E54F020000250003C7E8@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Wed, 13 Apr 2011 18:02:55 -0500 From: "Kevin Grittner" To: "Tom Lane" Cc: "Jeff Wu" , Subject: Re: BUG #5974: UNION construct type cast gives poor error message References: <201104122018.p3CKIlWR042915@wwwmaster.postgresql.org><201104122018.p3CKIlWR042915@wwwmaster.postgresql.org> <9799.1302719551@sss.pgh.pa.us> <4DA5B8A4020000250003C7A9@gw.wicourts.gov><4DA5B8A4020000250003C7A9@gw.wicourts.gov> <11920.1302727156@sss.pgh.pa.us> <4DA5CADB020000250003C7BE@gw.wicourts.gov><4DA5CADB020000250003C7BE@gw.wicourts.gov> <24771.1302730369@sss.pgh.pa.us> In-Reply-To: <24771.1302730369@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/88 X-Sequence-Number: 30007 Tom Lane wrote: > so far as I can see the spec simply disallows a > not-explicitly-cast NULL constant in cases like this, which seems > if anything even less friendly than what we're doing. Just to illustrate the current behavior: test=# select null union select 1; ?column? ---------- 1 (2 rows) test=# select null union select null union select 1; ERROR: UNION types text and integer cannot be matched LINE 1: select null union select null union select 1; ^ test=# select null union (select null union select 1); ?column? ---------- 1 (2 rows) So, we're talking about making the second of these three cases work, too. I'm not sure the spec requires *any* of them to work. -Kevin