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 CAApHDvqRG-cd92D2YV8+C3wLAT0_1ut=X4yX0DetGQ+gGAhtRA@mail.gmail.com
Whole thread Raw
In response to BUG #18451: NULL fails to coerce to string when performing string comparison  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #18451: NULL fails to coerce to string when performing string comparison
List pgsql-bugs
On Wed, 1 May 2024 at 09:06, PG Bug reporting form
<noreply@postgresql.org> wrote:
> postdb=# select where 'ab'||NULL like '%a%';
> --
> (0 rows)
>
> postdb=# select where 'ab'||NULL::text like '%a%';
> --
> (0 rows)

You've not mentioned where you think the bug is, but if you think it's
in either of the above, PostgreSQL is following the SQL standard here.

The SQL2016 copy I have here says:

"6.31 <string value expression>

If at least one of S1 and S2 is the null value, then the result of the
<concatenation> is the null value."

There are a few RDBMSs that are lax on this rule, perhaps you're here
because PostgreSQL isn't doing what you're used to?

David



pgsql-bugs by date:

Previous
From: Darryl Dixon
Date:
Subject: Re: BUG #18451: NULL fails to coerce to string when performing string comparison
Next
From: Darryl Dixon
Date:
Subject: Re: BUG #18451: NULL fails to coerce to string when performing string comparison