Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 4E6871337BC8 for ; Wed, 13 Apr 2011 18:15:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 32177-01-2 for ; Wed, 13 Apr 2011 21:15:06 +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 95D8B1337C5E for ; Wed, 13 Apr 2011 18:10:13 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Wed, 13 Apr 2011 16:10:12 -0500 Message-Id: <4DA5CADB020000250003C7BE@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Wed, 13 Apr 2011 16:10:03 -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> In-Reply-To: <11920.1302727156@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/84 X-Sequence-Number: 30003 Tom Lane wrote: > Consider > > select '1' union select '1 '; > > How many rows does that produce? You cannot answer without > imputing a data type to the columns. "text" will give a different > answer than "integer" or "bpchar". Well, if we were to assign both to type unknown initially, we would clearly need to resolve that before execution, But I'm not expecting that such execution would happen before analyzing the rest of the query. If the above is on the left side of a union with select 1; the unknown could then be resolved to integer. I expect that all of this should happen before any of the unions is *executed*. Perhaps I'm arguing for the same thing you were, but just have my head tilted at a different angle? -Kevin