Re: BUG #17575: row(NULL) IS NULL inconsistent with IS NOT DISTINCT FROM NULL

From: Алексей Борщёв <aborschev(at)gmail(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17575: row(NULL) IS NULL inconsistent with IS NOT DISTINCT FROM NULL
Date: 2022-08-08 14:03:49
Message-ID: CAD2_BUMLTZAU7FYbaHm0scERfErd=J0-Eetvu1nJFqgd2Uf7bQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank You, David and Tom!
Now these tricks around row(null) are much clearer to me!
I think this issue should be closed.

пт, 5 авг. 2022 г. в 17:23, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > I noticed strange behavior of ROW(NULL):
> > I expect, that IS NULL operator should give the same result as IS NOT
> > DISTINCT FROM NULL
> > similarly, IS NOT NULL operator should give the same result as IS DISTINCT
> > FROM NULL:
>
> I don't see any particular reason to expect that. row(NULL)
> is a row object containing one null field, which is in fact not
> identical to a null composite value. The SQL spec dictates that
> IS NULL should return true for both cases, but that doesn't mean
> that no other operator is allowed to distinguish them. I'd say
> that this is a wart of IS NULL rather than desirable behavior
> we should copy elsewhere.
>
> > Next point:
> > I expected that IS NULL and IS NOT NULL operators must always return
> > opposite results, but:
>
> You have not read the SQL standard, then. It's quite clear
> about that.
>
> > Can we fix or document this PG issue?
>
> ... nor our documentation. See
>
> https://www.postgresql.org/docs/current/functions-comparison.html
>
> para beginning "If the expression is row-valued,", near the
> bottom of the page.
>
> regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Yugo NAGATA 2022-08-08 15:21:02 Re: BUG #17434: CREATE/DROP DATABASE can be executed in the same transaction with other commands
Previous Message Alvaro Herrera 2022-08-08 11:34:01 Re: BUG #17508: ja.po for pg_ctl has an obvious mistake