BUG #17883: Segmentation fault when create brin index on user-defined type. - Mailing list pgsql-bugs
From | PG Bug reporting form |
---|---|
Subject | BUG #17883: Segmentation fault when create brin index on user-defined type. |
Date | |
Msg-id | 17883-7bb64f11e60bc1ef@postgresql.org Whole thread Raw |
Responses |
Re: BUG #17883: Segmentation fault when create brin index on user-defined type.
|
List | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 17883 Logged by: Wenbo Email address: linwenbo1994@gmail.com PostgreSQL version: 15.2 Operating system: fedora Description: Create a user-defined type and operators. Then create Brin index on this type. create table t_sva(sva text); insert into t_sva values('1118090878'); insert into t_sva values('2345010477'); create or replace function normalize_si(text) RETURNS text AS $$ BEGIN RETURN substring($1,9,2) || substring($1,7,2) || substring($1,5,2) || substring($1,1,4); END;$$ LANGUAGE 'plpgsql' IMMUTABLE; create or replace function si_lt(text,text) RETURNS boolean AS $$ BEGIN RETURN normalize_si($1) < normalize_si($2); END;$$ LANGUAGE 'plpgsql' IMMUTABLE; create or replace function si_le(text,text) RETURNS boolean AS $$ BEGIN RETURN normalize_si($1) <= normalize_si($2); END;$$ LANGUAGE 'plpgsql' IMMUTABLE; create or replace function si_ge(text,text) RETURNS boolean AS $$ BEGIN RETURN normalize_si($1) >= normalize_si($2); END;$$ LANGUAGE 'plpgsql' IMMUTABLE; create or replace function si_gt(text,text) RETURNS boolean AS $$ BEGIN RETURN normalize_si($1) > normalize_si($2); END;$$ LANGUAGE 'plpgsql' IMMUTABLE; create operator <# (PROCEDURE = si_lt, LEFTARG=text, RIGHTARG=text); create operator <=# (PROCEDURE = si_le, LEFTARG=text, RIGHTARG=text); create operator >=# (PROCEDURE = si_ge, LEFTARG=text, RIGHTARG=text); create operator ># (PROCEDURE = si_gt, LEFTARG=text, RIGHTARG=text); create or replace function si_same(text,text) RETURNS int AS $$ BEGIN IF normalize_si($1) < normalize_si($2) THEN RETURN -1; ELSIF normalize_si($1) > normalize_si($2) THEN RETURN +1; ELSE RETURN 0; END IF; END; $$ LANGUAGE 'plpgsql' IMMUTABLE; CREATE OPERATOR CLASS sva_special_ops FOR TYPE text using brin AS OPERATOR 1 <#, OPERATOR 2 <=#, OPERATOR 3 >=#, OPERATOR 4 >#, function 1 si_same(text,text); CREATE INDEX idx_special1 ON t_sva using brin(sva sva_special_ops); this will cause a segmentation fault, the stack is: Program received signal SIGSEGV, Segmentation fault. 0x000000000096e7fc in MakeExpandedObjectReadOnlyInternal (d=25) at expandeddatum.c:100 100 if (!VARATT_IS_EXTERNAL_EXPANDED_RW(DatumGetPointer(d))) (gdb) bt #0 0x000000000096e7fc in MakeExpandedObjectReadOnlyInternal (d=25) at expandeddatum.c:100 #1 0x00007fd535228f1e in plpgsql_param_eval_var_ro (state=0x2e17e28, op=0x2e17ff8, econtext=0x2e17d48) at pl_exec.c:6545 #2 0x00000000006f2f88 in ExecInterpExpr (state=0x2e17e28, econtext=0x2e17d48, isnull=0x7ffec01bc0a7) at execExprInterp.c:1079 #3 0x00000000006f42c4 in ExecInterpExprStillValid (state=0x2e17e28, econtext=0x2e17d48, isNull=0x7ffec01bc0a7) at execExprInterp.c:1826 #4 0x00007fd53521dc6b in ExecEvalExpr (state=0x2e17e28, econtext=0x2e17d48, isNull=0x7ffec01bc0a7) at ../../../../src/include/executor/executor.h:322 #5 0x00007fd5352289ad in exec_eval_simple_expr (estate=0x7ffec01bc350, expr=0x2e413a8, result=0x7ffec01bc018, isNull=0x7ffec01bc0a7, rettype=0x7ffec01bc064, rettypmod=0x7ffec01bc060) at pl_exec.c:6193 #6 0x00007fd535227d4c in exec_eval_expr (estate=0x7ffec01bc350, expr=0x2e413a8, isNull=0x7ffec01bc0a7, rettype=0x7ffec01bc064, rettypmod=0x7ffec01bc060) at pl_exec.c:5681 #7 0x00007fd535227c9e in exec_eval_boolean (estate=0x7ffec01bc350, expr=0x2e413a8, isNull=0x7ffec01bc0a7) at pl_exec.c:5646 #8 0x00007fd535221a13 in exec_stmt_if (estate=0x7ffec01bc350, stmt=0x2e10e98) at pl_exec.c:2502 #9 0x00007fd535220ac2 in exec_stmts (estate=0x7ffec01bc350, stmts=0x2e10ee8) at pl_exec.c:2025 #10 0x00007fd53522080b in exec_stmt_block (estate=0x7ffec01bc350, block=0x2e10f38) at pl_exec.c:1932 #11 0x00007fd5352200a7 in exec_toplevel_block (estate=0x7ffec01bc350, block=0x2e10f38) at pl_exec.c:1623 #12 0x00007fd53521e193 in plpgsql_exec_function (func=0x2db1930, fcinfo=0x7ffec01bc5d0, simple_eval_estate=0x0, simple_eval_resowner=0x0, procedure_resowner=0x0, atomic=true) at pl_exec.c:612 #13 0x00007fd535238467 in plpgsql_call_handler (fcinfo=0x7ffec01bc5d0) at pl_handler.c:277 #14 0x0000000000aa945f in FunctionCall1Coll (flinfo=0x2e12a08, collation=0, arg1=25) at fmgr.c:1124 #15 0x000000000048dc1c in brin_build_desc (rel=0x7fd53528bbb8) at brin.c:1217 #16 0x000000000048de55 in initialize_brin_buildstate (idxRel=0x7fd53528bbb8, revmap=0x2e01a68, pagesPerRange=128) at brin.c:1288 #17 0x000000000048d2ad in brinbuild (heap=0x7fd5352872b8, index=0x7fd53528bbb8, indexInfo=0x2e2cf58) at brin.c:865 #18 0x000000000059b075 in index_build (heapRelation=0x7fd5352872b8, indexRelation=0x7fd53528bbb8, indexInfo=0x2e2cf58, isreindex=false, parallel=true) at index.c:3021 #19 0x00000000005983bf in index_create (heapRelation=0x7fd5352872b8, indexRelationName=0x2d31560 "idx_special1", indexRelationId=16406, parentIndexRelid=0, parentConstraintId=0, relFileNode=0, indexInfo=0x2e2cf58, indexColNames=0x2e026e8, accessMethodObjectId=3580, tableSpaceId=0, collationObjectId=0x2e02750, classObjectId=0x2e02768, coloptions=0x2e02780, reloptions=0, flags=0, constr_flags=0, allow_system_table_mods=false, is_internal=false, constraintId=0x7ffec01bca34) at index.c:1252 #20 0x000000000067c3ee in DefineIndex (relationId=16384, stmt=0x2d31748, indexRelationId=0, parentIndexId=0, parentConstraintId=0, is_alter_table=false, check_rights=true, check_not_in_use=true, skip_build=false, quiet=false) at indexcmds.c:1155 #21 0x0000000000916e83 in ProcessUtilitySlow (pstate=0x2e2ce48, pstmt=0x2d31ac8, queryString=0x2d30b38 "CREATE INDEX idx_special1 ON t_sva using brin(sva sva_special_ops);", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x2d31ba8, qc=0x7ffec01bd390) at utility.c:1543 #22 0x0000000000916033 in standard_ProcessUtility (pstmt=0x2d31ac8, queryString=0x2d30b38 "CREATE INDEX idx_special1 ON t_sva using brin(sva sva_special_ops);", readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x2d31ba8, qc=0x7ffec01bd390) at utility.c:1074 #23 0x0000000000915231 in ProcessUtility (pstmt=0x2d31ac8, queryString=0x2d30b38 "CREATE INDEX idx_special1 ON t_sva using brin(sva sva_special_ops);", readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x2d31ba8, qc=0x7ffec01bd390) at utility.c:530 #24 0x000000000091407b in PortalRunUtility (portal=0x2d9e698, pstmt=0x2d31ac8, isTopLevel=true, setHoldSnapshot=false, dest=0x2d31ba8, qc=0x7ffec01bd390) at pquery.c:1158 #25 0x000000000091427a in PortalRunMulti (portal=0x2d9e698, isTopLevel=true, setHoldSnapshot=false, dest=0x2d31ba8, altdest=0x2d31ba8, qc=0x7ffec01bd390) at pquery.c:1315 #26 0x0000000000913862 in PortalRun (portal=0x2d9e698, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x2d31ba8, altdest=0x2d31ba8, qc=0x7ffec01bd390) at pquery.c:791 #27 0x000000000090d918 in exec_simple_query (query_string=0x2d30b38 "CREATE INDEX idx_special1 ON t_sva using brin(sva sva_special_ops);") at postgres.c:1250 #28 0x0000000000911be1 in PostgresMain (dbname=0x2d5c648 "postgres", username=0x2d5c628 "linwenbo") at postgres.c:4593 #29 0x0000000000863aae in BackendRun (port=0x2d536e0) at postmaster.c:4511 #30 0x0000000000863447 in BackendStartup (port=0x2d536e0) at postmaster.c:4239 #31 0x000000000085fcec in ServerLoop () at postmaster.c:1806 #32 0x000000000085f5c9 in PostmasterMain (argc=3, argv=0x2d2a090) at postmaster.c:1478 #33 0x0000000000774729 in main (argc=3, argv=0x2d2a090) at main.c:202
pgsql-bugs by date: