Re: BUG #18692: Segmentation fault when extending a varchar column with a gist index with custom signal length

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tender Wang <tndrwang(at)gmail(dot)com>, nicolas(dot)maus(at)bertelsmann(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18692: Segmentation fault when extending a varchar column with a gist index with custom signal length
Date: 2024-11-08 02:22:42
Message-ID: CAPpHfdtZ2a=1FbZXUeEbx0i-avsQb=6UE9Kg8eTLoQzt3KaY0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Nov 8, 2024 at 4:05 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Alexander Korotkov <aekorotkov(at)gmail(dot)com> writes:
> > On Thu, Nov 7, 2024 at 8:47 AM Tender Wang <tndrwang(at)gmail(dot)com> wrote:
> >> Based on Tom's analysis, I provide a POC patch. I'm not sure if it is right
> >> to use DEFAULT_COLLATION_OID in the patch.
>
> > Thank you. But I'm not sure about DEFAULT_COLLATION_OID.
>
> I don't quite trust that either. But since we only care about
> equality, wouldn't it be OK to use C_COLLATION_OID?
>
> > Therefore, we can compare two text[] just with datumIsEqual().
> > Attached patch implements this.
>
> I think this is nonsense. What about toasted datums, or even
> just short-header ones? The one coming from an on-disk tuple
> is pretty likely to be short-header for plausible sizes of
> the options, but the one we just constructed in memory will
> not be.

You are correct. I quickly skim trough the sources and didn't find a
function which compares detoasted contents of Datums excluding
headers. So, yes, comparison using C-collation seems the most
reasonable option.

------
Regards,
Alexander Korotkov
Supabase

Attachment Content-Type Size
v2-0001-Fix-arrays-comparison-in-CompareOpclassOptions.patch application/octet-stream 3.7 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tender Wang 2024-11-08 02:26:32 Re: BUG #18692: Segmentation fault when extending a varchar column with a gist index with custom signal length
Previous Message Tom Lane 2024-11-08 02:05:48 Re: BUG #18692: Segmentation fault when extending a varchar column with a gist index with custom signal length