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

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: 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-14 13:48:17
Message-ID: ec61c89f-6d2a-46b0-9746-4646ef7c5060@vondra.me
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

The operators seem a bit off too, because there's no 'equality'
operator, and if I add '=#' as equality operator, then this seems to
work for me:

CREATE OPERATOR CLASS sva_special_ops FOR TYPE text using brin AS
FUNCTION 1 brin_minmax_opcinfo(internal),
FUNCTION 2 brin_minmax_add_value(internal, internal, internal, internal),
FUNCTION 3 brin_minmax_consistent(internal, internal, internal),
FUNCTION 4 brin_minmax_union(internal, internal, internal),
OPERATOR 1 <#,
OPERATOR 2 <=#,
OPERATOR 3 =#,
OPERATOR 4 >=#,
OPERATOR 5 >#;

regards

--
Tomas Vondra

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Aleksander Alekseev 2024-11-14 13:51:53 Re: Libpq library error when doing physical Replication
Previous Message 2024-11-14 12:49:26 Sorting Discrepancy in PostgreSQL 14.13