Re: Strange interaction of union and expressions

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Aaron Bingham <bingham(at)cenix-bioscience(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Gregory Gimenez <gimenez(at)cenix-bioscience(dot)com>
Subject: Re: Strange interaction of union and expressions
Date: 2005-04-20 20:08:04
Message-ID: Pine.GSO.4.62.0504210006210.28522@ra.sai.msu.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I see no problem. You get what you want.

Correct query is:

select '"' || foo || '"' as foo
from (select foo from a union select foo from b ) as bar;

Oleg

On Wed, 20 Apr 2005, Aaron Bingham wrote:

> 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,
>
>

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2005-04-20 20:10:50 Re: Strange interaction of union and expressions
Previous Message Jan Wieck 2005-04-20 19:52:46 Re: I'm OWNER of the db but I get `permission denied` when