Re: Error with union in sub-selects - Mailing list pgsql-bugs

From Christof Petig
Subject Re: Error with union in sub-selects
Date
Msg-id 83DC79A8.1A0AB07D@wtal.de
Whole thread Raw
In response to Error with union in sub-selects  (pgsql-bugs@postgresql.org)
List pgsql-bugs
Martin Neimeier wrote:

> Hello,
> some additional informations:
>
> - if i execute the subselect alone, it works fine !.
> - The same select statement works with sybase and oracle, so i think its a legal statement.
> - After reading in the sql2-standard, i have found nothing which restricts unions in sub-selects.
>

Create a temp table (I did it this way):

instead of
select x from table where x in (select A union select B);

create temp table t1 (x type_of_x; );
insert into t1 select A union select B;
select x from table where exists (select t1.x from t1 where t1.x=table.x);

Using exists instead of in circumvents another restriction of PostgreSQL.

Tom Lane said, these bugs would be addressed during the query tree reorganization (7.2, in 2001)

>
> (I don't want to use another rdbms ... i want to use PostgreSQL :-)))))
>
> If somebody has a workaround, then i am the happiest person for the day.

Could be ... if you can live with this ...

    Christof

pgsql-bugs by date:

Previous
From: Dronamraju Rajesh
Date:
Subject: what utilities do i need for postgres on solaris 7 ??
Next
From: Ludovic LANGE
Date:
Subject: PostgreSQL crashes using distance operator whith records where 'point' data type set to null