Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWUIx-0028v6-32 for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Dec 2025 06:49:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vWUIw-006hhV-2r for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Dec 2025 06:49:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWUIw-006hhN-1s for pgsql-hackers@lists.postgresql.org; Fri, 19 Dec 2025 06:49:35 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vWUIu-001YU5-31 for pgsql-hackers@postgresql.org; Fri, 19 Dec 2025 06:49:35 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-477bf34f5f5so9425455e9.0 for ; Thu, 18 Dec 2025 22:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766126971; x=1766731771; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wo4o/vrsJ8IsyirgiAeQgVzhrRTe2VAF4B6K2biH71U=; b=H1Mc2hYgWfJPJtudY8IHk7MeqRxoxWvlAbtTlM2gHx9VuCvqny3i4ZyFLcPV3SWCSO 2oFRNfTluE4XASuu2Z0MxDqzaOTFueGx/aeEUj4FdItE1H7LUA1ZD1zhjL/s0/OuvRYU 9U+4oHQLygI4rAX22kVyJO33Ogcb2kNt94FAVfBpmJvomFfxpzKBaj049UNqc2lhXQf3 +4qu1K7QeyLlPRSS5H10Pmupa2RTTfaqUdifTSdMNqpB8ShVwK+aQhNCyCKVFUX0H8n4 h0RdziRMBZKVxKSvR3C1hRAXnJcPOkHAFLeojKsyF3hByxGalR6xDymEd8KvjKm+HdxD 4t5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766126971; x=1766731771; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wo4o/vrsJ8IsyirgiAeQgVzhrRTe2VAF4B6K2biH71U=; b=AbtafQabWNdHB9AR8jsXg8Er65Ef6mwtd8j48ndgiU/0NY92cWoOMxkHQpH7QXq50y QrAm71a8kWnodBlafXu3q5AS2wYufky5VoVTKawpIwj8CT/IR+YzreZMq+WIOI8nwWbL 3skpjmZxWvY0PDnmr3aVD5a6PA8GoK6LfiywZl+tr0MM5IgCeqv+8emdS+/ixB09cG7r yYakkoc1jyKP61C24Hzddn5514IgBCD+LHIQlTOsdxuU2bAPeYw7VFYLWJeqvnCdga/9 e4VCMWksTBe4xEXzNOheRPCcw8toTaGYnACjPWDVsuWhks8P1UyFeyg1D4O5OjWPufDY W2ww== X-Gm-Message-State: AOJu0YzgA1lHwDvEgPhQZqsAWYXJ+UaLs/lzFxmnGBkbaWr+vUKpBNd3 gk5WIalxP2etkp5KdrqKLrkF6woL8Uoqo+I8CvDv2sE8q2uwcmeiL0P+ X-Gm-Gg: AY/fxX7GFD0GAqzMUUE5XvbDFxy/vs+E6rakzWVYxLmNVFSEWLT3QNOWtyahiHFV1rQ iiuYJfJjMvmz19K1Q3NVfCvgNzjbcZ86h3SqB1w9Md7nQWU+/FcYoFNJ7M5XE67rPUct2SuSAm5 NGjgZ/24aRqnlQ18wKnOralp1xopqZRcSktOsRHJDLSiHjbvu/xGJVrbbByejoHi5k0uJ9VL+iy sbWY2KCreINsskzQF//7BUfjHkvlbCRuv9q8IijL5VamwZTsOzt+xEcWxoDL7DA+r5eJ334j4ee CBBm+FDYo0DZuYxC2Mj7rbcCGE4mP3VooyNuZUgA1q58kZa4tlQHGlMhVBRWgH8DlYekdTX12w/ iG23yNfilfDF906fhzi/HU8OMnpLMecNiOK16cZZtPGeqNCFeph81Y406vvHYT9byDhAWgnKNV7 WcWfkG3J3TjtB8TLcb0qMin4bhl7G2I74cBfzUA/gzMsD61U+JhRkbCtwDbdNx6UFrI/dwdbiQR 5N3hz/RBG2riu83uTj/M4gDTT3FVPeQceP+WYFlPaNpBN2LhcrPUr1s X-Google-Smtp-Source: AGHT+IHIQA0IX8khj1XXzlVLJy3hpNmnUGrFJeq67+hrF4MEqnsGxwgqbb83XsP961T5fxIGtOH0DA== X-Received: by 2002:a05:600c:8107:b0:477:6374:6347 with SMTP id 5b1f17b1804b1-47d19594ce3mr13156395e9.22.1766126971064; Thu, 18 Dec 2025 22:49:31 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47d193cba81sm29007165e9.10.2025.12.18.22.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Dec 2025 22:49:30 -0800 (PST) Date: Fri, 19 Dec 2025 06:49:29 +0000 From: Bertrand Drouvot To: Sami Imseih Cc: pgsql-hackers Subject: Re: Refactor query normalization into core query jumbling Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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