| From: | Александр Кожемякин <a(dot)kozhemyakin(at)postgrespro(dot)ru> |
|---|---|
| To: | Jeff Davis <pgsql(at)j-davis(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Remaining dependency on setlocale() |
| Date: | 2026-01-20 05:27:11 |
| Message-ID: | 456f7143-51ea-4342-b4a1-85f0d9b6c79f@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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(at)entry=0x0) at
./wctype/wcfuncs_l.c:59
#1 0x00005cae0fba2e48 in strlower_libc_mb (locale=0x5cae1b988118,
srclen=<optimized out>, 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(at)entry=0x7ffcc8ff4e3c "\264r",
dstsize=dstsize(at)entry=12, src=src(at)entry=0x72b485860f0a "14",
srclen=srclen(at)entry=1, locale=0x5cae1b988118)
at /pgpro/postgres/src/backend/utils/adt/pg_locale_libc.c:127
#3 0x00005cae0fba0aed in pg_strfold (dst=dst(at)entry=0x7ffcc8ff4e3c
"\264r", dstsize=dstsize(at)entry=12, src=src(at)entry=0x72b485860f0a "14",
srclen=srclen(at)entry=1, locale=<optimized out>)
at /pgpro/postgres/src/backend/utils/adt/pg_locale.c:1339
#4 0x000072b490092828 in ltree_crc32_sz (buf=buf(at)entry=0x72b485860f0a
"14", size=2) at /pgpro/postgres/contrib/ltree/crc32.c:40
#5 0x000072b4900912bd in hashing (siglen=<optimized out>,
t=0x72b485860f00, sign=<optimized out>) at
/pgpro/postgres/contrib/ltree/_ltree_gist.c:43
#6 _ltree_compress (fcinfo=<optimized out>) at
/pgpro/postgres/contrib/ltree/_ltree_gist.c:77
#7 0x00005cae0fc3b724 in FunctionCall1Coll
(flinfo=flinfo(at)entry=0x5cae1ba42b60, collation=<optimized out>,
arg1=arg1(at)entry=140723680661328) at
/pgpro/postgres/src/backend/utils/fmgr/fmgr.c:1139
#8 0x00005cae0f732f53 in gistCompressValues
(giststate=giststate(at)entry=0x5cae1ba41f38, r=r(at)entry=0x72b48db65b68,
attdata=0x7ffcc8ff5280, isnull=isnull(at)entry=0x7ffcc8ff5260,
isleaf=isleaf(at)entry=true,
compatt=compatt(at)entry=0x7ffcc8ff4fc0) at
/pgpro/postgres/src/backend/access/gist/gistutil.c:618
#9 0x00005cae0f73302c in gistFormTuple (giststate=0x5cae1ba41f38,
r=r(at)entry=0x72b48db65b68, attdata=<optimized out>,
isnull=0x7ffcc8ff5260, isleaf=isleaf(at)entry=true)
at /pgpro/postgres/src/backend/access/gist/gistutil.c:581
#10 0x00005cae0f72ab72 in gistBuildCallback (index=0x72b48db65b68,
tid=0x5cae1ba2bae4, values=<optimized out>, isnull=<optimized out>,
tupleIsAlive=<optimized out>, 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=<optimized out>, anyvisible=false,
progress=true,
start_blockno=0, numblocks=4294967295, callback=0x5cae0f72ab20
<gistBuildCallback>, 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=<optimized out>,
callback=0x5cae0f72ab20 <gistBuildCallback>, index_info=<optimized out>,
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(at)entry=0x72b48db667d8,
indexRelation=indexRelation(at)entry=0x72b48db65b68,
indexInfo=indexInfo(at)entry=0x5cae1baa02f0,
isreindex=isreindex(at)entry=false, parallel=parallel(at)entry=true) at
/pgpro/postgres/src/backend/catalog/index.c:3078
#15 0x00005cae0f7edc9e in index_create
(heapRelation=heapRelation(at)entry=0x72b48db667d8,
indexRelationName=indexRelationName(at)entry=0x5cae1b949e68 "ind",
indexRelationId=<optimized out>,
indexRelationId(at)entry=0, parentIndexRelid=parentIndexRelid(at)entry=0,
parentConstraintId=parentConstraintId(at)entry=0, relFileNumber=<optimized
out>, indexInfo=<optimized out>,
indexColNames=<optimized out>, accessMethodId=<optimized out>,
tableSpaceId=<optimized out>, collationIds=<optimized out>,
opclassIds=<optimized out>, opclassOptions=<optimized out>,
coloptions=<optimized out>, stattargets=<optimized out>,
reloptions=<optimized out>, flags=<optimized out>,
constr_flags=<optimized out>, allow_system_table_mods=<optimized out>,
is_internal=<optimized out>, constraintId=<optimized out>) at
/pgpro/postgres/src/backend/catalog/index.c:1278
#16 0x00005cae0f88ab1e in DefineIndex (tableId=tableId(at)entry=16577,
stmt=stmt(at)entry=0x5cae1b94a040, indexRelationId=indexRelationId(at)entry=0,
parentIndexId=parentIndexId(at)entry=0,
parentConstraintId=parentConstraintId(at)entry=0,
total_parts=total_parts(at)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(at)entry=0x5cae1baa01e0, pstmt=pstmt(at)entry=0x5cae1b94a150,
queryString=queryString(at)entry=0x5cae1b949480 "CREATE INDEX \"ind\"
ON \"public\".\"tbl\" USING \"gist\" (\"t\");",
context=context(at)entry=PROCESS_UTILITY_TOPLEVEL, params=params(at)entry=0x0,
queryEnv=queryEnv(at)entry=0x0, qc=0x7ffcc8ff62f0, dest=<optimized
out>) 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=<optimized out>,
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(at)entry=0x5cae1b9ca0f0, pstmt=pstmt(at)entry=0x5cae1b94a150,
isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x5cae1b94a510, qc=qc(at)entry=0x7ffcc8ff62f0) at
/pgpro/postgres/src/backend/tcop/pquery.c:1153
#20 0x00005cae0fade37d in PortalRunMulti
(portal=portal(at)entry=0x5cae1b9ca0f0, isTopLevel=isTopLevel(at)entry=true,
setHoldSnapshot=setHoldSnapshot(at)entry=false,
dest=dest(at)entry=0x5cae1b94a510,
altdest=altdest(at)entry=0x5cae1b94a510, qc=qc(at)entry=0x7ffcc8ff62f0)
at /pgpro/postgres/src/backend/tcop/pquery.c:1310
#21 0x00005cae0fade8c2 in PortalRun (portal=portal(at)entry=0x5cae1b9ca0f0,
count=count(at)entry=9223372036854775807, isTopLevel=isTopLevel(at)entry=true,
dest=dest(at)entry=0x5cae1b94a510,
altdest=altdest(at)entry=0x5cae1b94a510, qc=qc(at)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=<optimized out>,
username=<optimized out>) at
/pgpro/postgres/src/backend/tcop/postgres.c:4766
#24 0x00005cae0fad63f3 in BackendMain (startup_data=<optimized out>,
startup_data_len=<optimized out>) at
/pgpro/postgres/src/backend/tcop/backend_startup.c:124
#25 0x00005cae0fa24a72 in postmaster_child_launch (child_type=<optimized
out>, child_slot=2, startup_data=startup_data(at)entry=0x7ffcc8ff67c0,
startup_data_len=startup_data_len(at)entry=24,
client_sock=client_sock(at)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(at)entry=3,
argv=argv(at)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
>
>
>
>
>
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Michael Paquier | 2026-01-20 05:03:55 | Re: A minor grammar error was found in a comment in the smgrtruncate function |