Re: BUG #18451: NULL fails to coerce to string when performing string comparison - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #18451: NULL fails to coerce to string when performing string comparison
Date
Msg-id CAApHDvq3CcqqymBK4ov2hX_MhSGkDLtL9LeYWhj_Gb7q7-xmVQ@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18451: NULL fails to coerce to string when performing string comparison  (Darryl Dixon <darryl.dixon@gmail.com>)
List pgsql-bugs
On Wed, 1 May 2024 at 10:01, Darryl Dixon <darryl.dixon@gmail.com> wrote:
>
> The bug is that:
> 1) The concatenation is not producing NULL, but rather Text, and yet the comparison fails regardless, and

I think you're just wrongly assuming casting an unknown NULL to a type
is making it somehow non-NULL. That's just not the case. NULLs can
have a type. They're still NULL.

postgres=# select 'ab' || NULL::text is null;
 ?column?
----------
 t

David



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18451: NULL fails to coerce to string when performing string comparison
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #18451: NULL fails to coerce to string when performing string comparison