Re: BUG #18451: NULL fails to coerce to string when performing string comparison

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Darryl Dixon <darryl(dot)dixon(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18451: NULL fails to coerce to string when performing string comparison
Date: 2024-04-30 22:08:41
Message-ID: CAApHDvq3CcqqymBK4ov2hX_MhSGkDLtL9LeYWhj_Gb7q7-xmVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 1 May 2024 at 10:01, Darryl Dixon <darryl(dot)dixon(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2024-04-30 22:09:06 Re: BUG #18451: NULL fails to coerce to string when performing string comparison
Previous Message Tom Lane 2024-04-30 22:07:01 Re: BUG #18451: NULL fails to coerce to string when performing string comparison