Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sdBVk-00Djzl-E3 for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Aug 2024 16:33:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sdBVi-00CJ0X-LY for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Aug 2024 16:33:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sdBVi-00CJ0O-Bb for pgsql-hackers@lists.postgresql.org; Sun, 11 Aug 2024 16:33:38 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sdBVg-004JAw-0p for pgsql-hackers@postgresql.org; Sun, 11 Aug 2024 16:33:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 47BGXUq63804934; Sun, 11 Aug 2024 12:33:30 -0400 From: Tom Lane To: Jeff Davis cc: Peter Eisentraut , Andreas Karlsson , pgsql-hackers@postgresql.org Subject: Re: tiny step toward threading: reduce dependence on setlocale() In-reply-to: <23cc1f3cfcdbdd3b2d3bb956d57ae422aa9d0b9e.camel@j-davis.com> References: <2228884bb1f1a02614b39f71a90c94d2cc8a3a2f.camel@j-davis.com> <239b7ef6ce058c6b1c77b3a0cfcc70c1cd8968b1.camel@j-davis.com> <56af65bde2190cc5ee20c807be7b7bdcda54f40c.camel@j-davis.com> <468dd1fb-20f5-4213-bc70-d1388ccf28fa@proxel.se> <59ea4275d75829a055fc55d8fe139eb85764cf2b.camel@j-davis.com> <89475ee5487d795124f4e25118ea8f1853edb8cb.camel@j-davis.com> <23cc1f3cfcdbdd3b2d3bb956d57ae422aa9d0b9e.camel@j-davis.com> Comments: In-reply-to Jeff Davis message dated "Tue, 06 Aug 2024 14:40:17 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3804932.1723394010.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 11 Aug 2024 12:33:30 -0400 Message-ID: <3804933.1723394010@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeff Davis 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 i= n Generic_Text_IC_like() 200 * on the pattern and text, but instead call SB_lower_char on eac= h 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 t= he long 203 * way. 204 */ 205 = >>> CID 1616189: Null pointer dereferences (REVERSE_INULL) >>> Null-checking "locale" suggests that it may be null, but it has al= ready been dereferenced on all paths leading to the check. 206 if (pg_database_encoding_max_length() > 1 || (locale && locale->p= rovider =3D=3D COLLPROVIDER_ICU)) 207 { 208 pat =3D DatumGetTextPP(DirectFunctionCall1Coll(lower, collation, 209 PointerGetDatum(pat))); 210 p =3D VARDATA_ANY(pat); 211 plen =3D VARSIZE_ANY_EXHDR(pat); I assume it would now be okay to take out "locale &&" here? regards, tom lane