NULL safe equality operator

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: NULL safe equality operator
Date: 2005-11-25 02:17:56
Message-ID: 43867454.6090105@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi guys,

Does anyone know how I'd go about implementing the following MySQL
operator in PostgreSQL?

---

NULL-safe equal. This operator performs an equality comparison like the
= operator, but returns 1 rather than NULL if both operands are NULL,
and 0 rather than NULL if one operand isNULL.

mysql> SELECT 1 <=> 1, NULL <=> NULL, 1 <=> NULL;
-> 1, 1, 0
mysql> SELECT 1 = 1, NULL = NULL, 1 = NULL;
-> 1, NULL, NULL

---

Chris

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Glaesemann 2005-11-25 02:34:43 Re: NULL safe equality operator
Previous Message Qingqing Zhou 2005-11-24 21:27:05 Re: gprof SELECT COUNT(*) results