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 23:02:55
Message-ID: 4DA5E54F020000250003C7E8@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:

> so far as I can see the spec simply disallows a
> not-explicitly-cast NULL constant in cases like this, which seems
> if anything even less friendly than what we're doing.

Just to illustrate the current behavior:

test=# select null union select 1;
?column?
----------
1

(2 rows)

test=# select null union select null union select 1;
ERROR: UNION types text and integer cannot be matched
LINE 1: select null union select null union select 1;
^
test=# select null union (select null union select 1);
?column?
----------

1
(2 rows)

So, we're talking about making the second of these three cases work,
too. I'm not sure the spec requires *any* of them to work.

-Kevin

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-04-13 23:26:06 Re: BUG #5974: UNION construct type cast gives poor error message
Previous Message Kevin Grittner 2011-04-13 22:47:36 Re: BUG #5974: UNION construct type cast gives poor error message