public inbox for [email protected]
help / color / mirror / Atom feedFrom: Bertrand Drouvot <[email protected]>
To: Sami Imseih <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: Refactor query normalization into core query jumbling
Date: Fri, 19 Dec 2025 06:49:29 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAA5RZ0tZp5qU0ikZEEqJnxvdSNGh1DWv80sb-k4QAUmiMoOp_Q@mail.gmail.com>
References: <CAA5RZ0tZp5qU0ikZEEqJnxvdSNGh1DWv80sb-k4QAUmiMoOp_Q@mail.gmail.com>
Hi,
On Thu, Dec 18, 2025 at 06:44:17PM -0600, Sami Imseih wrote:
> For the second point, since JumbleState can be shared by multiple
> extensions, hooks should receive it as a const pointer. This
> signals read-only intent and prevents extensions from
> accidentally modifying it through the hook. This change is in
> 0002. This does mean that extensions will need to update their
> hooks, but I do not see that as an issue for a major version.
I can see that 0001 is doing:
-static void fill_in_constant_lengths(JumbleState *jstate, const char *query,
and then:
+static void
+fill_in_constant_lengths(const JumbleState *jstate, const char *query,
Should the const addition be in 0002? But...
While looking at fill_in_constant_lengths(), I can see that it is doing:
locs = jstate->clocations;
and then things like:
locs[i].length = -1
or
locs[i].length = strlen(yyextra.scanbuf + loc)
While this is technically correct so the compiler does not complain (because
clocations is a non const pointer in JumbleState and the added const does not
apply to what clocations points to), I think that adding const here is misleading.
Indeed, the function clearly modifies data accessible through the parameter.
Thoughts?
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
view thread (34+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Refactor query normalization into core query jumbling
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox