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

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: 503699317(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, PG Bug reporting form <noreply(at)postgresql(dot)org>
Subject: Re: BUG #18705: Segmentation fault when create brin index on user-defined type.
Date: 2024-11-15 15:38:45
Message-ID: e47f0a40-f778-4165-90fb-3fa1be786234@vondra.me
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 11/15/24 07:17, Tender Wang wrote:
>
>
> Tomas Vondra <tomas(at)vondra(dot)me <mailto:tomas(at)vondra(dot)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?
>

I think it might be improved to do some checks, yes. The CREATE OPERATOR
CLASS should be able to signatures of the functions - it's AM-specific,
and there's a limit how much can be checked. For example these functions
have "internal" arguments, which can be an arbitrary pointer.

That being said, I'm not aware of anyone working on such checks. Might
be a nice first patch, though.

regards

--
Tomas Vondra

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-11-15 15:47:14 Re: BUG #18705: Segmentation fault when create brin index on user-defined type.
Previous Message Etienne LAFARGE 2024-11-15 14:47:26 Today's Postgres Releases break login roles