From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: 503699317@qq.com
Subject: BUG #18705: Segmentation fault when create brin index on user-defined type.
Date: Thu, 14 Nov 2024 02:40:27 +0000
Message-ID: <18705-29cc90ff31682f19@postgresql.org> (raw)
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.
!?>
!?>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, 503699317@qq.com
Subject: Re: BUG #18705: Segmentation fault when create brin index on user-defined type.
In-Reply-To: <18705-29cc90ff31682f19@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox