Re: BUG #5974: UNION construct type cast gives poor error message - Mailing list pgsql-bugs

From Kevin Grittner
Subject Re: BUG #5974: UNION construct type cast gives poor error message
Date
Msg-id 4DA5E1B8020000250003C7DC@gw.wicourts.gov
Whole thread Raw
In response to Re: BUG #5974: UNION construct type cast gives poor error message  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #5974: UNION construct type cast gives poor error message  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom Lane <tgl@sss.pgh.pa.us> 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #5978: Running postgress in a shell script fails
Next
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5974: UNION construct type cast gives poor error message