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 21:10:03
Message-ID: 4DA5CADB020000250003C7BE@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:

> 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-04-13 21:32:49 Re: BUG #5974: UNION construct type cast gives poor error message
Previous Message Tom Lane 2011-04-13 20:39:16 Re: BUG #5974: UNION construct type cast gives poor error message