Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id EB7131337B9C for ; Wed, 13 Apr 2011 19:47:59 -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 06124-08 for ; Wed, 13 Apr 2011 22:47:41 +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 181F31337B93 for ; Wed, 13 Apr 2011 19:47:40 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Wed, 13 Apr 2011 17:47:41 -0500 Message-Id: <4DA5E1B8020000250003C7DC@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Wed, 13 Apr 2011 17:47:36 -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/87 X-Sequence-Number: 30006 Tom Lane wrote: > you wish that in > > (select '1' union select '2') union select 3 > > the fact that the third value is clearly integer would influence > the choice of the resolved type of the first UNION. Yeah. > My vision of how to implement that is different than what you seem > to have in mind, but it would come out with the same answer. OK > The sticking point is just that in purely syntactic terms this is > action-at-a-distance, and so it's hard to square with the spec. I > think that our current reading (in which the '1' and '2' get > resolved as text) is actually closer to what the spec says. Would the approach you have in mind accept a query which is valid under the spec yet return different results? If not, we can legitimately call it an extension. If we're not going to do that, there's probably some room to improve our error reporting and/or documentation around this issue. -Kevin