Re: Error with union in sub-selects

From: Christof Petig <christof(dot)petig(at)wtal(dot)de>
To: Martin Neimeier <nei(at)ibn(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Error with union in sub-selects
Date: 1904-01-02 15:24:25
Message-ID: 83DC79A8.1A0AB07D@wtal.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Oliver Elphick 1998-11-25 23:48:51 Failures with arrays
Previous Message Robert E. Bruccoleri 0100-07-27 00:21:08 Re: Index selection on a large table