Skip site navigation (1) Skip section navigation (2)

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: 2000-09-25 09:39:13
Message-ID: 83DC79A8.1A0AB07D@wtal.de (view raw or flat)
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

pgsql-bugs by date

Next:From: Ludovic LANGEDate: 2000-09-25 19:55:13
Subject: PostgreSQL crashes using distance operator whith records where 'point' data type set to null
Previous:From: Tom LaneDate: 2000-09-15 19:20:57
Subject: Re: libpq bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group