Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)
Date: 2024-03-04 18:08:03
Message-ID: CAEudQAo-w9hGeqTT3KAvurSRPgPH3rrNtMxnoCbVqxPp=8mrgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em seg., 4 de mar. de 2024 às 14:54, Matthias van de Meent <
boekewurm+postgres(at)gmail(dot)com> escreveu:

> On Mon, 4 Mar 2024 at 18:39, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> >
> > Hi,
> >
> > The function var_strcmp is a critical function.
> > Inside the function, there is a shortcut condition,
> > which allows for a quick exit.
> >
> > Unfortunately, the current code calls a very expensive function
> beforehand, which if the test was true, all the call time is wasted.
> > So, IMO, it's better to postpone the function call until when it is
> actually necessary.
>
> Thank you for your contribution.
>
> I agree it would be better, but your current patch is incorrect,
> because we need to check if the user has access to the locale (and
> throw an error if not) before we return that the two strings are
> equal.
>
I can't see any user validation at the function pg_newlocale_from_collation.

meson test pass all checks.

best regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-03-04 18:19:45 Re: RFC: Logging plan of the running query
Previous Message Matthias van de Meent 2024-03-04 17:54:32 Re: Avoid is possible a expensive function call (src/backend/utils/adt/varlena.c)