Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group