Re: tiny step toward threading: reduce dependence on setlocale() - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: tiny step toward threading: reduce dependence on setlocale()
Date
Msg-id cc41de25-1dd2-4b38-98d8-69f47499eae6@eisentraut.org
Whole thread Raw
In response to Re: tiny step toward threading: reduce dependence on setlocale()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: tiny step toward threading: reduce dependence on setlocale()
List pgsql-hackers
On 11.08.24 18:33, Tom Lane wrote:
> Jeff Davis <pgsql@j-davis.com> writes:
>> We can address those as part of a separate thread. I'll count this as
>> committed.
> 
> Coverity has a nit about this:
> 
> *** CID 1616189:  Null pointer dereferences  (REVERSE_INULL)
> /srv/coverity/git/pgsql-git/postgresql/src/backend/utils/adt/like.c: 206 in Generic_Text_IC_like()
> 200          * on the pattern and text, but instead call SB_lower_char on each
> 201          * character.  In the multi-byte case we don't have much choice :-(. Also,
> 202          * ICU does not support single-character case folding, so we go the long
> 203          * way.
> 204          */
> 205
>>>>      CID 1616189:  Null pointer dereferences  (REVERSE_INULL)
>>>>      Null-checking "locale" suggests that it may be null, but it has already been dereferenced on all paths
leadingto the check.
 
> 206         if (pg_database_encoding_max_length() > 1 || (locale && locale->provider == COLLPROVIDER_ICU))
> 207         {
> 208             pat = DatumGetTextPP(DirectFunctionCall1Coll(lower, collation,
> 209                                                          PointerGetDatum(pat)));
> 210             p = VARDATA_ANY(pat);
> 211             plen = VARSIZE_ANY_EXHDR(pat);
> 
> I assume it would now be okay to take out "locale &&" here?

Correct, that check is no longer necessary.




pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: Adding OLD/NEW support to RETURNING
Next
From: Peter Eisentraut
Date:
Subject: Re: Remove support for old realpath() API