Re: BUG #6064: != NULL, <> NULL do not work [sec=UNCLASSIFIED]

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "Pilling, Michael" <Michael(dot)Pilling(at)dsto(dot)defence(dot)gov(dot)au>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6064: != NULL, <> NULL do not work [sec=UNCLASSIFIED]
Date: 2011-12-01 14:17:59
Message-ID: 201112011417.pB1EHx902225@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


Applied.

---------------------------------------------------------------------------

Bruce Momjian wrote:
> Pilling, Michael wrote:
> > Hi Kevin,
> >
> > Thanks for that. Point entirely taken. I think what I would add would
> > be in the table 9-1 of operators, an extra column filled in only for
> > =, <> and != saying Important: see difference from IS [NOT] NULL.
> > Perhaps one reason I didn't pick up on this subtle issue is that IS
> > NULL and IS NOT NULL are not listed in this table but they are
> > comparison operators, just textual rather than symbolic ones in the
> > grammar so they should be in the table. I recall specifically looking
> > up what is the not equal operator in this language and only going
> > forward from the table, not realising I had to read any further.
> >
> > I'd also add after "Do not write expression = NULL because NULL is not
> > "equal to" NULL." Do not write expression != NULL or <> NULL because
> > NULL is not "not equal to" NULL. because while implied, it's not
> > obvious that because = doesn't work with NULL that != doesn't either.
>
> I have written the attached patch to mention <> NULL also returns NULL.
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + It's impossible for everything to be true. +

[ text/x-diff is unsupported, treating like TEXT/PLAIN ]

> diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
> new file mode 100644
> index be92e6a..ddfb29a
> *** a/doc/src/sgml/func.sgml
> --- b/doc/src/sgml/func.sgml
> ***************
> *** 364,371 ****
> </indexterm>
> Ordinary comparison operators yield null (signifying <quote>unknown</>),
> not true or false, when either input is null. For example,
> ! <literal>7 = NULL</> yields null. When this behavior is not suitable,
> ! use the
> <literal>IS <optional> NOT </> DISTINCT FROM</literal> constructs:
> <synopsis>
> <replaceable>expression</replaceable> IS DISTINCT FROM <replaceable>expression</replaceable>
> --- 364,371 ----
> </indexterm>
> Ordinary comparison operators yield null (signifying <quote>unknown</>),
> not true or false, when either input is null. For example,
> ! <literal>7 = NULL</> yields null, as does <literal>7 &lt;&gt; NULL</>. When
> ! this behavior is not suitable, use the
> <literal>IS <optional> NOT </> DISTINCT FROM</literal> constructs:
> <synopsis>
> <replaceable>expression</replaceable> IS DISTINCT FROM <replaceable>expression</replaceable>

>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message magnus 2011-12-01 14:39:31 BUG #6312: Test bug
Previous Message Josh Kupershmidt 2011-12-01 14:06:57 Re: 9.1.1 hot standby startup gets sigbus