Thread: EXISTS / IN - does it work on Postgresql?

EXISTS / IN - does it work on Postgresql?

From
paula@cyberlazarus.net
Date:
Hello there,

Finally I got a \"yes\" and I\'m moving from Microsoft SQL Server to Postgresql. I\'m using PHP4 and PHPLIB to work
withquery abstractions. I have a lot of subqueries like: 

WHERE ... EXISTS (SELECT ...)

I was researching and found ambiguous information about this kind of subqueries, is that working fine with Postgresql?

Thanks in advance,

/paula

paula@nervesane.net
paula@cyberlazarus.net


----------------------------------------------------------------
:: www.nervemail.net :: free access to POP3 accounts


Re: EXISTS / IN - does it work on Postgresql?

From
Peter Eisentraut
Date:
paula@cyberlazarus.net writes:

> WHERE ... EXISTS (SELECT ...)
>
> I was researching and found ambiguous information about this kind of subqueries, is that working fine with
Postgresql?

Yes.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: EXISTS / IN - does it work on Postgresql?

From
Stephan Szabo
Date:
On 19 Sep 2001 paula@cyberlazarus.net wrote:

> Hello there,
>
> Finally I got a \"yes\" and I\'m moving from Microsoft SQL Server to
> Postgresql. I\'m using PHP4 and PHPLIB to work with query
> abstractions. I have a lot of subqueries like:
>
> WHERE ... EXISTS (SELECT ...)
>
> I was researching and found ambiguous information about this kind of
> subqueries, is that working fine with Postgresql?

In general, yes.  Although IN (<subquery>) queries are rather slow right
now and you might want to look at rewriting those as EXISTS (...)
instead (there's an FAQ item on this with a very simple example).