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.
!?>
!?>