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 4DA5E54F020000250003C7E8@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
List pgsql-bugs
Tom Lane <tgl@sss.pgh.pa.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

pgsql-bugs by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: BUG #5974: UNION construct type cast gives poor error message
Next
From: Tom Lane
Date:
Subject: Re: BUG #5974: UNION construct type cast gives poor error message