Strange interaction of union and expressions

From: Aaron Bingham <bingham(at)cenix-bioscience(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Gregory Gimenez <gimenez(at)cenix-bioscience(dot)com>
Subject: Strange interaction of union and expressions
Date: 2005-04-20 17:24:08
Message-ID: l8d5spjr9j.fsf@lynx.cenix-bioscience.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,

We noticed some very odd behavior today with Postgres 7.4.5

Running the following SQL:

create table a (foo varchar);
insert into a (foo) values ('baz');
create table b (foo varchar);
insert into b (foo) values ('woof');
select '"' || foo || '"' as foo
from (select foo from a) as bar
union select foo from b;

Produces this output:

foo
-------
"baz"
woof
(2 rows)

I would expect the following instead:

foo
-------
"baz"
"woof"
(2 rows)

Is this a known issue? Has it been fixed?

Thanks,

--
--------------------------------------------------------------------
Aaron Bingham
Software Engineer
Cenix BioScience GmbH
--------------------------------------------------------------------

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Gagnon 2005-04-20 17:36:08 Re: Regular expression. How to disable ALL meta-character
Previous Message Michael Fuhr 2005-04-20 16:59:29 Re: Regular expression. How to disable ALL meta-character in a regular expression