Search Postgresql Archives

Strange interaction of union and expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux