From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Darryl Dixon <darryl(dot)dixon(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #18451: NULL fails to coerce to string when performing string comparison |
Date: | 2024-05-01 02:34:34 |
Message-ID: | CAApHDvoeD9rWT0Wd6edZVJfWgaK5Nc2B7yz-SQ65KNpSjovgJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Wed, 1 May 2024 at 10:30, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > Fair, we don’t explicitly document that ‘…’ || NULL yields NULL. It’s more
> > of “unless otherwise noted doing stuff with null results in unknown/null
> > outcomes”.
>
> Yeah, there's a documentation gap here. I dug around a little and
> really couldn't find anything anywhere in our SGML docs that explains
> NULL in any detail; we tend to assume that you've already heard of it.
> There are a couple of parenthetical remarks in func.sgml that
> reference the notion that NULL means "unknown", but you'd never
> find those if you were looking for an explanation of what NULL is.
> Perhaps that'd be worth a few paras somewhere, though I'm not
> very sure where's a good place.
What is really generic enough about SQL NULLs to put somewhere
generic? I mean NULL = NULL is NULL rather than true, but NULLs are
treated as equal in DISTINCT and GROUP BY. It seems to me it would be
hard to generically write something about it without referencing
specific situations, and if we have to do that, why don't we just
write it specifically in that location?
I see we already mention that false and NULL don't match in a WHERE
clause in [1], per "(i.e., if the result is false or null)". Maybe
that could be expanded to elaborate more on 3-way SQL boolean logic
and [2] could be expanded to mention that concatenating a NULL yields
NULL.
David
[1] https://www.postgresql.org/docs/current/queries-table-expressions.html#QUERIES-WHERE
[2] https://www.postgresql.org/docs/current/functions-string.html
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-05-01 02:53:45 | Re: BUG #18451: NULL fails to coerce to string when performing string comparison |
Previous Message | David Rowley | 2024-05-01 01:30:23 | Re: BUG #17855: Uninitialised memory used when the name type value processed in binary mode of Memoize |