pg.ddx.io pgsql-bugs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
BUG #6202: type of union column selection bug 2+ messages / 2 participants [nested] [flat]
* BUG #6202: type of union column selection bug @ 2011-09-10 01:41 Roman <zotov@oe-it.ru> 0 siblings, 1 reply; 2+ messages in thread From: Roman @ 2011-09-10 01:41 UTC (permalink / raw) To: pgsql-bugs The following bug has been logged online: Bug reference: 6202 Logged by: Roman Email address: zotov@oe-it.ru PostgreSQL version: 9.0.4 Operating system: Win7x64 Description: type of union column selection bug Details: Query select null union select 4 is Ok but select null union select null union select 4 is Fail i think it`s a bug because you choose type in second query twice null and null -> text text and int -> fail and i think what check type category is not true, because i can`t create implicit cast to resolve some problems, like select 'a' union select 4 if i have implicit cast int->text i think it must work!! Sorry second part is not bug it`s a feature but it`s my problem too ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #6202: type of union column selection bug @ 2011-09-22 01:28 Robert Haas <robertmhaas@gmail.com> parent: Roman <zotov@oe-it.ru> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2011-09-22 01:28 UTC (permalink / raw) To: Roman <zotov@oe-it.ru>; +Cc: pgsql-bugs On Fri, Sep 9, 2011 at 9:41 PM, Roman <zotov@oe-it.ru> wrote: > Query > select null union select 4 > is Ok but > select null union select null union select 4 > is Fail > > i think it`s a bug because you choose type in second query twice > null and null -> text > text and int -> fail Yeah, this is lousy. Unfortunately, it's also not easy to fix, so I think we're stuck with it for now. You can fix it by casting the NULL constants to int, e.g.: SELECT null::int4 UNION SELECT null::int4 UNION SELECT 4 > and i think what check type category is not true, because i can`t create > implicit cast to resolve some problems, like > select 'a' union select 4 > if i have implicit cast int->text i think it must work!! > > Sorry second part is not bug it`s a feature but it`s my problem too Sadly, I don't think that'll work - the undecorated literal is going to be treated as "unknown", not text. Implicitly casting int to text is maybe not a good idea; we removed those casts on purpose in PostgreSQL 8.3. But if you want to restore (much of) the pre-8.3 behavior, you might want to have a look at this blog post: http://petereisentraut.blogspot.com/2008/03/readding-implicit-casts-in-postgresql.html But in this case I think you're likely to still need a cast in there somewhere. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-09-22 01:28 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2011-09-10 01:41 BUG #6202: type of union column selection bug Roman <zotov@oe-it.ru> 2011-09-22 01:28 ` Robert Haas <robertmhaas@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox