pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: will@heroku.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6626: union all with values of type "unknown"
Date: Tue, 22 May 2012 15:55:49 -0400
Message-ID: <7003.1337716549@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoZgbsVsjDNxGbp9w1AmPMWz0G72ccCcckPdMM6251uuCA@mail.gmail.com>
References: <E1SQ6tg-0003qf-5P@wrigleys.postgresql.org>
	<CA+TgmoZgbsVsjDNxGbp9w1AmPMWz0G72ccCcckPdMM6251uuCA@mail.gmail.com>

Robert Haas <robertmhaas@gmail.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



view thread (5+ messages)  latest in thread

Message-ID: <7003.1337716549@sss.pgh.pa.us>
Permalink:  ../7003.1337716549@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7003.1337716549@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, will@heroku.com
  Subject: Re: BUG #6626: union all with values of type "unknown"
  In-Reply-To: <7003.1337716549@sss.pgh.pa.us>
  References: <E1SQ6tg-0003qf-5P@wrigleys.postgresql.org> <CA+TgmoZgbsVsjDNxGbp9w1AmPMWz0G72ccCcckPdMM6251uuCA@mail.gmail.com> <7003.1337716549@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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