BUG #18705: Segmentation fault when create brin index on user-defined type. - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #18705: Segmentation fault when create brin index on user-defined type.
Date
Msg-id 18705-29cc90ff31682f19@postgresql.org
Whole thread Raw
Responses Re: BUG #18705: Segmentation fault when create brin index on user-defined type.
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      18705
Logged by:          shenzheng
Email address:      503699317@qq.com
PostgreSQL version: 15.5
Operating system:   centos
Description:

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);


OUTPUT:
postgres=# CREATE INDEX idx_special1 ON t_sva using brin(sva
sva_special_ops);
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.
!?>
!?>


pgsql-bugs by date:

Previous
From: Elie Gedeon
Date:
Subject: Regression from postgresql14 to postgresql17 with postgis (osm2pgsql)
Next
From: PG Bug reporting form
Date:
Subject: BUG #18707: Installation issue