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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: BUG #6064: != NULL, <> NULL do not work [sec=UNCLASSIFIED]
Дата
Msg-id 201112011417.pB1EHx902225@momjian.us
обсуждение исходный текст
Ответ на Re: BUG #6064: != NULL, <> NULL do not work [sec=UNCLASSIFIED]  (Bruce Momjian <bruce@momjian.us>)
Список 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@momjian.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 <> 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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Josh Kupershmidt
Дата:
Сообщение: Re: 9.1.1 hot standby startup gets sigbus
Следующее
От: magnus@hagander.net
Дата:
Сообщение: BUG #6312: Test bug