Re: BUG #5974: UNION construct type cast gives poor error message

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jeff Wu" <jwu(at)atlassian(dot)com>,<pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5974: UNION construct type cast gives poor error message
Date: 2011-04-13 22:47:36
Message-ID: 4DA5E1B8020000250003C7DC@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2011-04-13 23:02:55 Re: BUG #5974: UNION construct type cast gives poor error message
Previous Message Tom Lane 2011-04-13 21:50:16 Re: BUG #5978: Running postgress in a shell script fails