| From: | David Fetter <david(at)fetter(dot)org> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | David Salisbury <salisbury(at)globe(dot)gov>, pgsql-general(at)postgresql(dot)org |
| Subject: | Re: exclusive OR possible within a where clause? |
| Date: | 2011-10-14 16:58:37 |
| Message-ID: | 20111014165837.GB32530@fetter.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Thu, Oct 13, 2011 at 07:49:59PM -0400, Tom Lane wrote:
> David Salisbury <salisbury(at)globe(dot)gov> writes:
> > Short version, is there a way to implement an exclusive OR in a where clause?
>
> The boolean <> operator will do the trick.
>
> (x = y) <> (a = b)
>
> regards, tom lane
Factoring in NULLable columns, that's:
(x IS NOT DISTINCT FROM y) <> (a IS NOT DISTINCT FROM b)
Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Julien Rouhaud | 2011-10-14 17:00:56 | Re: Confused About pg_* Tables |
| Previous Message | Julien Rouhaud | 2011-10-14 16:57:20 | Re: Confused About pg_* Tables |