Re: BUG #17847: Unaligned memory access in ltree_gist

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17847: Unaligned memory access in ltree_gist
Date: 2023-04-19 16:26:15
Message-ID: CAPpHfdtaZ_sb8Nar-1Kjpc4P-MS5kx5NCL+--L+2Bu47WnJ53w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi!

On Tue, Apr 18, 2023 at 6:25 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Pavel Borisov <pashkin(dot)elfe(at)gmail(dot)com> writes:
> > On Tue, 18 Apr 2023 at 19:06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> The DETAIL message's grammar seems a bit off. Also, this is confusing the
> >> range limitation with the alignment requirement. How about just saying
> >> ERROR: siglen value must be a multiple of 4

This message is changed as you proposed.

> > I definitely like this wording.
>
> >> and leaving out-of-range cases to be handled by the existing check?
>
> > But that means that if we try 2025 then we just get it is not multiple
> > of 4 (and no clue of the range). Then we try 2028 and get another
> > error that it's outside of range. I suppose giving clues one by one
> > makes this look like a step-by-step quest. But in principle it's
> > possible.
>
> Well, that's the case just about everywhere else that there are multiple
> constraints on an input. It'd be impossibly unwieldy, and confusing,
> for every error message to include details on all the other errors
> you might have hit if you didn't hit that one.
>
> FWIW, I find it odd that the multiple-of-4 error comes out in advance
> of the range check; that seems backwards somehow. Maybe we should
> alter the order of applying the range check and the custom validator?

I think it was intended that custom validators work after builtin
validation, but the current order of validation is caused by bug. I
don't see why build_local_reloptions() should call custom validators
when validate == false. Patch 0001 fixes this. I propose to
backpatch this.

------
Regards,
Alexander Korotkov

Attachment Content-Type Size
0002-Validate-ltree-siglen-GiST-option-v4.patch application/octet-stream 4.3 KB
0001-Fix-custom-validators-call-in-build_local_relopti-v4.patch application/octet-stream 1.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2023-04-19 16:47:15 Re: BUG #17847: Unaligned memory access in ltree_gist
Previous Message Mark Guertin 2023-04-19 15:45:51 pg_basebackup: errors on macOS on directories with ".DS_Store" files