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.96) (envelope-from ) id 1vi4Gw-00E3yq-0F for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 05:27:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vi4Gu-00G1iG-16 for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 05:27:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vi4Gt-00G1i8-2P for pgsql-hackers@lists.postgresql.org; Tue, 20 Jan 2026 05:27:20 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vi4Gp-001MVp-2r for pgsql-hackers@postgresql.org; Tue, 20 Jan 2026 05:27:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1768886832; bh=Vpkj4MtkTjiEXoC6Ry+VYyFkJ/LBHigo2yN1F7iEouA=; h=Message-ID:Date:User-Agent:Subject:To:Cc:References:From: In-Reply-To:From; b=nYpRok617hgpm6i1yxNEu9BRmXyIt8AV3OYYval4ArHZ9dksMd7UR3cAp+NoMr+8a PFThUmShSHDRpuka62cf6bS2Vm6vYcp/y2641UJVALasi6/r5IJzL8YR9mATDbHDfU 5dnAyjls1/lyfBAUdy/SjppF7WpI0Jv3yxI/pcrNsqgcyKwsA4H39MSDa6/AgoFM2K muT8Ww5ZehtKFI5ncDQr4mqBscnxz2T4/PAlgtSMDuLrkB7clltGDhmcFatKdZ8ao8 MRy0TT+63yT8Duhq6rgWZnytR31G/pojWiVczW2YrfblZ0yhmv6g8arK5dGHj377ON EdZmtkZzWz29g== Received: from [172.30.48.62] (debian11-template.l.postgrespro.ru [192.168.2.254]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.kozhemyakin@postgrespro.ru) by mail.postgrespro.ru (Postfix/465) with ESMTPSA id 79B8B611CF; Tue, 20 Jan 2026 08:27:12 +0300 (MSK) Message-ID: <456f7143-51ea-4342-b4a1-85f0d9b6c79f@postgrespro.ru> Date: Tue, 20 Jan 2026 12:27:11 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Remaining dependency on setlocale() To: Jeff Davis , Peter Eisentraut , Chao Li Cc: Thomas Munro , Tom Lane , pgsql-hackers@postgresql.org References: <4c5da86af36a0d5e430eee3f60ce5e06f1b5cd34.camel@j-davis.com> <8186b28a1a39e61a0d833a4c25a8909ebbbabd48.camel@j-davis.com> <450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com> <78edc741a168c54d57cc898a5877b6443527a2c8.camel@j-davis.com> <83F6E6A9-FF29-41C9-9E15-EA5360E912D0@gmail.com> <5f65b85740197ba6249ea507cddf609f84a6188b.camel@j-davis.com> <38f3f4a6-e95e-47a7-914f-110dd6191301@eisentraut.org> <0e186a9a92634f0c5675a618ff5685d00cd8f836.camel@j-davis.com> <108e07a2-0632-4f00-984d-fe0e0d0ec726@eisentraut.org> <5267a39d41a00d5d5b3342f10c835cc9e3e27a2c.camel@j-davis.com> Content-Language: en-US From: =?UTF-8?B?0JDQu9C10LrRgdCw0L3QtNGAINCa0L7QttC10LzRj9C60LjQvQ==?= In-Reply-To: <5267a39d41a00d5d5b3342f10c835cc9e3e27a2c.camel@j-davis.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2026/01/20 03:29:00 #28131754 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk When executing the following query on branch REL_18_STABLE (first bad commit 806555e) CREATE DATABASE "testdb" WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'C'; \connect "testdb" CREATE EXTENSION IF NOT EXISTS "ltree" WITH SCHEMA "public"; CREATE TABLE "public"."tbl" (     "t" "public"."ltree"[] ); COPY "public"."tbl" ("t") FROM stdin; {14.30.13.5.26.9.22.23.14.10,22.8.20.1.10.28.6.27,16.30.10.7.29.4.9.21.22.13.26} \. CREATE INDEX "ind" ON "public"."tbl" USING "gist" ("t"); Program terminated with signal SIGSEGV, Segmentation fault. (gdb) bt #0  __GI___towlower_l (wc=49, locale=locale@entry=0x0) at ./wctype/wcfuncs_l.c:59 #1  0x00005cae0fba2e48 in strlower_libc_mb (locale=0x5cae1b988118, srclen=, src=0x72b485860f0a "14", destsize=12, dest=0x7ffcc8ff4e3c "\264r")     at /pgpro/postgres/src/backend/utils/adt/pg_locale_libc.c:215 #2  strlower_libc (dst=dst@entry=0x7ffcc8ff4e3c "\264r", dstsize=dstsize@entry=12, src=src@entry=0x72b485860f0a "14", srclen=srclen@entry=1, locale=0x5cae1b988118)     at /pgpro/postgres/src/backend/utils/adt/pg_locale_libc.c:127 #3  0x00005cae0fba0aed in pg_strfold (dst=dst@entry=0x7ffcc8ff4e3c "\264r", dstsize=dstsize@entry=12, src=src@entry=0x72b485860f0a "14", srclen=srclen@entry=1, locale=)     at /pgpro/postgres/src/backend/utils/adt/pg_locale.c:1339 #4  0x000072b490092828 in ltree_crc32_sz (buf=buf@entry=0x72b485860f0a "14", size=2) at /pgpro/postgres/contrib/ltree/crc32.c:40 #5  0x000072b4900912bd in hashing (siglen=, t=0x72b485860f00, sign=) at /pgpro/postgres/contrib/ltree/_ltree_gist.c:43 #6  _ltree_compress (fcinfo=) at /pgpro/postgres/contrib/ltree/_ltree_gist.c:77 #7  0x00005cae0fc3b724 in FunctionCall1Coll (flinfo=flinfo@entry=0x5cae1ba42b60, collation=, arg1=arg1@entry=140723680661328) at /pgpro/postgres/src/backend/utils/fmgr/fmgr.c:1139 #8  0x00005cae0f732f53 in gistCompressValues (giststate=giststate@entry=0x5cae1ba41f38, r=r@entry=0x72b48db65b68, attdata=0x7ffcc8ff5280, isnull=isnull@entry=0x7ffcc8ff5260, isleaf=isleaf@entry=true,     compatt=compatt@entry=0x7ffcc8ff4fc0) at /pgpro/postgres/src/backend/access/gist/gistutil.c:618 #9  0x00005cae0f73302c in gistFormTuple (giststate=0x5cae1ba41f38, r=r@entry=0x72b48db65b68, attdata=, isnull=0x7ffcc8ff5260, isleaf=isleaf@entry=true)     at /pgpro/postgres/src/backend/access/gist/gistutil.c:581 #10 0x00005cae0f72ab72 in gistBuildCallback (index=0x72b48db65b68, tid=0x5cae1ba2bae4, values=, isnull=, tupleIsAlive=, state=0x7ffcc8ff5660)     at /pgpro/postgres/src/backend/access/gist/gistbuild.c:836 #11 0x00005cae0f7544be in heapam_index_build_range_scan (heapRelation=0x72b48db667d8, indexRelation=0x72b48db65b68, indexInfo=0x5cae1baa02f0, allow_sync=, anyvisible=false, progress=true,     start_blockno=0, numblocks=4294967295, callback=0x5cae0f72ab20 , callback_state=0x7ffcc8ff5660, scan=0x5cae1ba2ba80) at /pgpro/postgres/src/backend/access/heap/heapam_handler.c:1705 #12 0x00005cae0f72b4e3 in table_index_build_scan (allow_sync=true, progress=true, scan=0x0, callback_state=, callback=0x5cae0f72ab20 , index_info=,     index_rel=0x72b48db65b68, table_rel=0x72b48db667d8) at /pgpro/postgres/src/include/access/tableam.h:1751 #13 gistbuild (heap=0x72b48db667d8, index=0x72b48db65b68, indexInfo=0x5cae1baa02f0) at /pgpro/postgres/src/backend/access/gist/gistbuild.c:313 #14 0x00005cae0f7ec6e3 in index_build (heapRelation=heapRelation@entry=0x72b48db667d8, indexRelation=indexRelation@entry=0x72b48db65b68, indexInfo=indexInfo@entry=0x5cae1baa02f0,     isreindex=isreindex@entry=false, parallel=parallel@entry=true) at /pgpro/postgres/src/backend/catalog/index.c:3078 #15 0x00005cae0f7edc9e in index_create (heapRelation=heapRelation@entry=0x72b48db667d8, indexRelationName=indexRelationName@entry=0x5cae1b949e68 "ind", indexRelationId=,     indexRelationId@entry=0, parentIndexRelid=parentIndexRelid@entry=0, parentConstraintId=parentConstraintId@entry=0, relFileNumber=, indexInfo=,     indexColNames=, accessMethodId=, tableSpaceId=, collationIds=, opclassIds=, opclassOptions=,     coloptions=, stattargets=, reloptions=, flags=, constr_flags=, allow_system_table_mods=,     is_internal=, constraintId=) at /pgpro/postgres/src/backend/catalog/index.c:1278 #16 0x00005cae0f88ab1e in DefineIndex (tableId=tableId@entry=16577, stmt=stmt@entry=0x5cae1b94a040, indexRelationId=indexRelationId@entry=0, parentIndexId=parentIndexId@entry=0,     parentConstraintId=parentConstraintId@entry=0, total_parts=total_parts@entry=-1, is_alter_table=false, check_rights=true, check_not_in_use=true, skip_build=false, quiet=false)     at /pgpro/postgres/src/backend/commands/indexcmds.c:1246 #17 0x00005cae0fae0be1 in ProcessUtilitySlow (pstate=pstate@entry=0x5cae1baa01e0, pstmt=pstmt@entry=0x5cae1b94a150,     queryString=queryString@entry=0x5cae1b949480 "CREATE INDEX \"ind\" ON \"public\".\"tbl\" USING \"gist\" (\"t\");", context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=params@entry=0x0,     queryEnv=queryEnv@entry=0x0, qc=0x7ffcc8ff62f0, dest=) at /pgpro/postgres/src/backend/tcop/utility.c:1544 #18 0x00005cae0fadfb49 in standard_ProcessUtility (pstmt=0x5cae1b94a150, queryString=0x5cae1b949480 "CREATE INDEX \"ind\" ON \"public\".\"tbl\" USING \"gist\" (\"t\");", readOnlyTree=,     context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x5cae1b94a510, qc=0x7ffcc8ff62f0) at /pgpro/postgres/src/backend/tcop/utility.c:1070 #19 0x00005cae0fade23f in PortalRunUtility (portal=portal@entry=0x5cae1b9ca0f0, pstmt=pstmt@entry=0x5cae1b94a150, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false,     dest=dest@entry=0x5cae1b94a510, qc=qc@entry=0x7ffcc8ff62f0) at /pgpro/postgres/src/backend/tcop/pquery.c:1153 #20 0x00005cae0fade37d in PortalRunMulti (portal=portal@entry=0x5cae1b9ca0f0, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=dest@entry=0x5cae1b94a510,     altdest=altdest@entry=0x5cae1b94a510, qc=qc@entry=0x7ffcc8ff62f0) at /pgpro/postgres/src/backend/tcop/pquery.c:1310 #21 0x00005cae0fade8c2 in PortalRun (portal=portal@entry=0x5cae1b9ca0f0, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, dest=dest@entry=0x5cae1b94a510,     altdest=altdest@entry=0x5cae1b94a510, qc=qc@entry=0x7ffcc8ff62f0) at /pgpro/postgres/src/backend/tcop/pquery.c:788 #22 0x00005cae0fada3fd in exec_simple_query (query_string=0x5cae1b949480 "CREATE INDEX \"ind\" ON \"public\".\"tbl\" USING \"gist\" (\"t\");") at /pgpro/postgres/src/backend/tcop/postgres.c:1273 #23 0x00005cae0fadc010 in PostgresMain (dbname=, username=) at /pgpro/postgres/src/backend/tcop/postgres.c:4766 #24 0x00005cae0fad63f3 in BackendMain (startup_data=, startup_data_len=) at /pgpro/postgres/src/backend/tcop/backend_startup.c:124 #25 0x00005cae0fa24a72 in postmaster_child_launch (child_type=, child_slot=2, startup_data=startup_data@entry=0x7ffcc8ff67c0, startup_data_len=startup_data_len@entry=24,     client_sock=client_sock@entry=0x7ffcc8ff67e0) at /pgpro/postgres/src/backend/postmaster/launch_backend.c:290 #26 0x00005cae0fa288a4 in BackendStartup (client_sock=0x7ffcc8ff67e0) at /pgpro/postgres/src/backend/postmaster/postmaster.c:3587 #27 ServerLoop () at /pgpro/postgres/src/backend/postmaster/postmaster.c:1702 #28 0x00005cae0fa2a39e in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0x5cae1b906f60) at /pgpro/postgres/src/backend/postmaster/postmaster.c:1400 #29 0x00005cae0f6f1dfe in main (argc=3, argv=0x5cae1b906f60) at /pgpro/postgres/src/backend/main/main.c:227 07.01.2026 05:20, Jeff Davis пишет: > On Tue, 2026-01-06 at 20:54 +0100, Peter Eisentraut wrote: >> On further reflection, it seems just as easy to have dmetaphone() >> take >> the input collation and use that to do a proper collation-aware >> upper-casing.  This has the same effect (that is, it will still only >> support certain single-byte encodings), but it avoids elaborately >> hard-coding a bunch of things, and if we ever want to make this >> multibyte-aware, then we'll have to go this way anyway, I think.  See >> attached patch. > Looks good to me. > > After you commit that, we still need the changes in fuzzystrmatch.c, > right? > > Regards, > Jeff Davis > > > > >