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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: 503699317(at)qq(dot)com
Subject: BUG #18705: Segmentation fault when create brin index on user-defined type.
Date: 2024-11-14 02:40:27
Message-ID: 18705-29cc90ff31682f19@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 18705
Logged by: shenzheng
Email address: 503699317(at)qq(dot)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.
!?>
!?>

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-11-14 08:41:36 BUG #18707: Installation issue
Previous Message Elie Gedeon 2024-11-13 19:01:44 Regression from postgresql14 to postgresql17 with postgis (osm2pgsql)