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=<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@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=<optimized out>)
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=<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@entry=0x5cae1ba42b60, collation=<optimized out>,
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=<optimized out>,
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=<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@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=<optimized out>,
indexRelationId@entry=0, parentIndexRelid=parentIndexRelid@entry=0,
parentConstraintId=parentConstraintId@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@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=<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@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=<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@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