Re: Performing antijoin in postgres

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Suresh_" <suiyengar(at)yahoo(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Performing antijoin in postgres
Date: 2007-08-31 09:36:13
Message-ID: 87wsvc11wy.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Suresh_" <suiyengar(at)yahoo(dot)com> writes:

> I want to add an antijoin operator to PostgreSql.

I think you can already do what you want like this:

SELECT *
FROM A FULL OUTER JOIN B ON (x=y)
WHERE x IS NULL
OR y IS NULL

So for example:

postgres=# select * from a;
i
---
1
2
(2 rows)

postgres=# select * from b;
i
---
2
3
(2 rows)

postgres=# select * from a full outer join b on (a.i=b.i) where a.i is null or b.i is null;
i | i
---+---
1 |
| 3
(2 rows)

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2007-08-31 12:08:43 Re: [GENERAL] Undetected corruption of table files
Previous Message Peter Eisentraut 2007-08-31 09:16:40 Re: [HACKERS] broken doc