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 1w61Tp-003rxz-2G for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 07:19:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w61To-0081Zn-0x for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Mar 2026 07:19:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w61Tn-0081Zf-3A for pgsql-hackers@lists.postgresql.org; Fri, 27 Mar 2026 07:19:40 +0000 Received: from mail-qv1-xf2c.google.com ([2607:f8b0:4864:20::f2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w61Tm-00000001HJt-1o3o for pgsql-hackers@postgresql.org; Fri, 27 Mar 2026 07:19:39 +0000 Received: by mail-qv1-xf2c.google.com with SMTP id 6a1803df08f44-89a06bc2f1bso28735786d6.1 for ; Fri, 27 Mar 2026 00:19:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774595977; cv=none; d=google.com; s=arc-20240605; b=HAa4o9n2pOELNRgUCsnmYc5OucMSfijKUD3W0D0QgbVHeB06GWZ+aK1IaufoNo/dXF zPd/yvcNQn6fIiO3bU1lwmX8RqWfN2lw0dVVyUKYr9P5HYI0bUatXgncain4+5EAQ1PG 3D0hZZpLeHgQjlf1FSgEYsswxMtt4FPUkDhP2KBr8AOGaZY/6jehSjvyq856c7v3NO6t XS5qbvSZ+zU4OqnVkZDkVS5S4+qReQmtQigEQsZRAtYNIM2pCvaugvj4yfQxy+10j7dP kkrF5d3K0oiRMwpKuouuqW0mvn7xHLPRsAZ29m8j87l31o10CmVvbiCjomQUla/nAXjw wNPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AZ5SeLTsRBzodFKBN34LP9GpxJjXaIp7u/5I2WUITjE=; fh=qWhafhkX4geaix9ypSzjgPf3P3d0/sE0l0Pq0buFS9w=; b=ioG2jLXV2W59cKXDGXDrSCST/T4yKph/sDxcq33BigGWVfhfhPGlv+64CSRfaY/b24 1nJavGttv+E19MqcUSf1AzfRgNcA0uTULNXpWRKmQWbMk/4/4JEz7dXx4jGyyZkh+ahb fW1mivyoWn6luYxDQlAeOOK1aC9nL7JrmWPi/Puvxps0U825tyuDlrGeIvNgIZtI9nuu FBQOVI/VMB0Y+sePBy/LKI12yiIvude+QhXy8istfyIrC0qQcC1dkiL0I8/iAh81+pqL Jey4onBmzVRzre0Bpe1LeDDPX+aM01ah2Ue/smzvw4mL+g/xUhnHSZjaK3ROWxldi5kr ZS4Q==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fittl.com; s=google; t=1774595977; x=1775200777; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AZ5SeLTsRBzodFKBN34LP9GpxJjXaIp7u/5I2WUITjE=; b=jwCCVSljfe8zZzdK9nFNmuAq3DlMrvjJNGYXeF/8/gwH3pmSMy0gFb9GUhyBCvYrQw eWqP4fsWepRg8c/ojtAJZU/Kib2mMhEIm96dCu30hSGeQnySqjVFtpv8tD+ivQnVydEk 0B0N2KVVPpZtOJOt3uW/5s4zU04A47uevSpDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774595977; x=1775200777; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=AZ5SeLTsRBzodFKBN34LP9GpxJjXaIp7u/5I2WUITjE=; b=EQFNoQydFp5xOjhvKuI/F+i63prx2hWt5oltnlFql8qJRXoK4V2PBh0E6A7vM2Dtsq RmMe7n8ob59rEUmjn1ts3+h55++bPG9vJskmyPwea1T9fYIpKcJegQ1ofF3F4EHgSE2t NeNS76cbpD5jvm4cRrRU1VvBkjzlyzRUfk3pzNav6Eu30tlCw7q+8uQdiNBUK6uo8+KG c+lKP0k4VgIwTVY5u2Asr4XikfDIY/twVsCAivGPHNWf98T5xi8zOAvvsV0+A26IxcY4 a8riMUHvh2sgQe/m1dxTxILxmRC/KMSpgWtb5qkcw9idQm+FzOJnYohkw7XI+JJFK8jV QOYw== X-Forwarded-Encrypted: i=1; AJvYcCUd6qYA2GBEkH5LmOXCiMPEyEV0yx3qW0DxsUj2TAEZoPM5s2fHYXL01uDmVgnol3amMX38eDAxsZSFyar2@postgresql.org X-Gm-Message-State: AOJu0YzUBqAt7tFst6FkzPR442F2aF8vdmsEmFw163T2KzikPKBzI2jj waxEA2NXkHj70Zy4OT9JwmVktAgwHj+iAzq2aN2/Mx88npnJKzBXhvt4Sk5ZHHuItUKqGHWVv0+ eMm14BhkI59iS/A4FsQpWBreZ49POMPc2/YRMfaOx X-Gm-Gg: ATEYQzxxCBC7XNtVy0Ii3MipY0uZ9szxMH5dpuYCpnfB+beiZYUj1vceuQBr0OKLeIy ZSNCAG5QVFslzMLeZF62K66rc5tUKs2ZZc1H4Sh6xPy650DMGPxJA0dV0cVEjoC8YZSIoWprwml HglJANRloeOsdGPMAUvy4If+/1ZatpL3hv/hkLAijr30vF559A4JaY7DFzSYci+5cfmVmqnbV+c LTu2D/0/0Mj6fks6Mlu1nKMr0o1yp3rMlvPZJNZMJYonYKxozKL7iZ3v7RI3ouS8mMu5NCUiPBj 3yJpjdLxeXDz3gQCaMw7IyFtucRAY54ii2XHs3d8 X-Received: by 2002:a05:6214:2485:b0:89c:e55b:604e with SMTP id 6a1803df08f44-89ce8d03248mr19083966d6.5.1774595977485; Fri, 27 Mar 2026 00:19:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Lukas Fittl Date: Fri, 27 Mar 2026 00:19:01 -0700 X-Gm-Features: AQROBzCNsurKHQR9VKsOQsXOHq0RTDuU5vzCzKL8fqOV_iNALHDhn2na1Rtsgc4 Message-ID: Subject: Re: Refactor query normalization into core query jumbling To: Michael Paquier Cc: Sami Imseih , zengman , pgsql-hackers , Julien Rouhaud Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 26, 2026 at 10:18=E2=80=AFPM Michael Paquier wrote: > This line of arguments is stronger for the normalization of the query > string. Why should the core code decide what a normalized string > should look like when it comes to the detection of the constants, if > any? Instead of a dollar-quoted number, we could enforce a bunch of > things, like a '?' or a '$woozah$' at these locations. Fair enough, though I haven't seen any extensions that do that in practice - its reasonable to have normalization result in a query string that's parsable again and can be passed to EXPLAIN (GENERIC_PLAN). > Saying that, the key point of the patch is to take a copy of the > JumbleState locations, and recompute it for the needs of PGSS for the > sake of the normalized query representation. Hence, why don't we just > do that at the end? That should be enough to enforce the const marker > for the JumbleState across all the loaded extensions that want to look > at it. This leads me to the simpler patch attached. > > Comments or tomatoes? That's simpler, and I'd be OK with just that > for v19. That would be much better than the current state of affairs, > where PGSS decides to enforce its own ideas in the JumbleState, ideas > fed to anything looping into the post-parse-analyze hook after PGSS. I'm not convinced that making the const change alone is a good idea, without also providing some helpers to reduce the repeated code in extensions. What if we only put the ComputeConstantLengths (as Sami had it in v7) in core, together with making JumbleState const? Thanks, Lukas --=20 Lukas Fittl