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

Re: BUG #6626: union all with values of type "unknown"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: will(at)heroku(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6626: union all with values of type "unknown"
Date: 2012-05-22 19:55:49
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> deik3qfhu265n6=> with hello as (select 'hello' as name)
>> deik3qfhu265n6-> , bye as (select 'bye' as name)
>> deik3qfhu265n6-> select * from hello UNION ALL select * from bye;
>> ERROR: failed to find conversion function from unknown to text

> I think it should return a column of type text, just as if you'd done this:
> select v from (select 'hello' union all select 'bye') x(v);

I don't think it's a great idea to make CTEs handle this differently
from other places where the same issue arises (from memory, views and
INSERT/SELECT have problems with unknown literals, and there are
probably other places I'm forgetting).

Should we institute a uniform policy of forcing unknown sub-select
outputs to text type?  This would almost certainly break a few peoples'
queries, but the reduction of surprise might be worth it for most.

			regards, tom lane

In response to


pgsql-bugs by date

Next:From: Robert HaasDate: 2012-05-22 19:57:10
Subject: Re: BUG #6626: union all with values of type "unknown"
Previous:From: Robert HaasDate: 2012-05-22 19:55:37
Subject: Re: pg_dump: SQL command failed

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