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

From Tender Wang
Subject Re: BUG #18705: Segmentation fault when create brin index on user-defined type.
Date
Msg-id CAHewXNnmBt7xzwhUY1HMQ8Ck=W5T9XJWpQj3qPPhgZcQjBPwNg@mail.gmail.com
Whole thread Raw
In response to Re: BUG #18705: Segmentation fault when create brin index on user-defined type.  (Tomas Vondra <tomas@vondra.me>)
Responses Re: BUG #18705: Segmentation fault when create brin index on user-defined type.
List pgsql-bugs


Tomas Vondra <tomas@vondra.me> 于2024年11月14日周四 21:48写道:
On 11/14/24 03:40, PG Bug reporting form wrote:
> ...
>
> 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);
>

I think this is a bit confused about CREATE OPERATOR CLASS. For BRIN
indexes this expects these 4 functions:

Support Function 1      internal function brin_minmax_opcinfo()
Support Function 2      internal function brin_minmax_add_value()
Support Function 3      internal function brin_minmax_consistent()
Support Function 4      internal function brin_minmax_union()

No wonder it crashes if CREATE OPERATOR CLASS passes si_same() instead
of brin_minmax_opcinfo.

Can we report errors not crash if users pass an unexpected function?


--
Thanks,
Tender Wang

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Sorting Discrepancy in PostgreSQL 14.13
Next
From: Tender Wang
Date:
Subject: Re: BUG #18396: Assert in gistFindCorrectParent() fails on inserting large tuples into gist index