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.94.2) (envelope-from ) id 1uEwBE-00FKor-3L for pgsql-hackers@arkaria.postgresql.org; Tue, 13 May 2025 20:24:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uEwBD-006pzg-1B for pgsql-hackers@arkaria.postgresql.org; Tue, 13 May 2025 20:24:47 +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.94.2) (envelope-from ) id 1uEwBC-006pzY-Hh for pgsql-hackers@lists.postgresql.org; Tue, 13 May 2025 20:24:46 +0000 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uEwB9-001dgh-2N for pgsql-hackers@lists.postgresql.org; Tue, 13 May 2025 20:24:45 +0000 Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-7c5e2fe5f17so681363585a.3 for ; Tue, 13 May 2025 13:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747167883; x=1747772683; darn=lists.postgresql.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=1hW7GJ6Dc+iSC1rKtyEE3mJnJC/HfBB5zZ3l1QJH/gU=; b=Qdi6A0jn0gdmOvqOEUYl0Zw46AWOE/jITabNiZVXBYkuFBxe9z92pPt4gFbpIZGCsc zLZbC5SwPkp5VIA4WHQD4qQEBXxmXp/rV07dZqxVWTc8wFzfJAgxqN3q8ZqL9kd5mO9U KaHaAClznf8ZVEJvXK02yYaXlRCKqq9+LXCOE+uU0V4fgIc2rOPuXjKxI7kRLTrIBHe2 MIOOE2Dc1IU68vZ9OUMkW0CgXZJEb3qGQrLcNyNsmDpr3fYLEBrYLCK6mO2DYgnrk4Cb HJ0iJCHFw/pziw6gpFUMFuhxIFK6KBfBx5yqUsQV7LqkPtfHcJ4d/9FzIyDqjP7cInp2 Rsgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747167883; x=1747772683; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1hW7GJ6Dc+iSC1rKtyEE3mJnJC/HfBB5zZ3l1QJH/gU=; b=a8A5SXSH74XBxMgGlIRqHO3VhE/+BAHz2i2auXCbevObqdm6f7xuvi9nK78+hyR7XC MsJBcZlsBXcd7WU1IAwtjltVFWzYcqYdhReVJrnmYv/+JtRZIU7N7t4MhWe0FthFJ8bH fGxU9YLr06DIj2ZiNDa4han8f2KdetZt8oLw7mWw+iIu2Xt8XMnye8+b6Ge8VFgLdYtQ eu/QaYQDqHKGDpXucw4iNlesA/Lh2unufafknFGqYlxf6EIvLX2fIeIGlwFtdUj6Fku5 sLb1PiX8LLGk/lDzBQ9Rx6wl6mEkSDIJE/PXtFaOuC7WjDnu6BysHDIWDl93QaDNsG/H sEXQ== X-Forwarded-Encrypted: i=1; AJvYcCWqqFaBo1O9dYMqJrfp/fZoL3LSqeruTPCb2Wm6rdzA/qDKMMnNj4stZzCD1n4ut6xJU+x1Ty4ZnZ9ajOZZ@lists.postgresql.org X-Gm-Message-State: AOJu0Yy9bm0J65iEj/9hKfZIjWzjCLN5K3QEailjCSgdf1/rk1cG23CI hzqFcvxSS4Gb55kmT1V3b9tiUgXNGTa5MGdWm9q58JKYrXQYjfiC X-Gm-Gg: ASbGnctDElstYKqrEDN15T1mpIaDeOpHXwZ1jbSVSxS9wAFVW5Q7wGDulXnsplOy2Oa DvXUPql7h7FPLlx9sp8MetV67AKfXaUid/y1kHlk/tZXeFDUMbpuwSjop8PiHn4JSqu+Qba9q0o mZhAKv50bHRW/Xmaec6bXqzc5HtXu19ig6MXMTwZuF1/c++pwnyKQxTC9WHZKtW1Q9QMN1q7Aa9 IYk3dLaoN+IaN1DAUJsBc2juCGDIPqyQgnzT9cqr2Pm14L4PeAbA+LFVe089FDskx1xyQxrh/XF 1S+kzq2vNOniXc1ERieLTm7/06vRD/CiEcSQFAEt4esoXaO7nGqsbPjDsTMKuFwknkrREyb6k+q AVd9LkRCxYKP3ZBVeEoxcHTAjQwpmoexSIdCr37S/m4IZ5wRe+K3AeZbfLlg= X-Google-Smtp-Source: AGHT+IHzthpLHJFd/uzeI9ZDIgrhu7ZADo3amJaQX1P8VSqh1YBqsbr5Iox3V8+GvQvDChIxfmPBLQ== X-Received: by 2002:a05:620a:24cb:b0:7c5:4711:dc56 with SMTP id af79cd13be357-7cd2886f374mr152449385a.48.1747167883074; Tue, 13 May 2025 13:24:43 -0700 (PDT) Received: from smtpclient.apple (modemcable171.6-163-184.mc.videotron.ca. [184.163.6.171]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7cd00fde7c9sm746422085a.75.2025.05.13.13.24.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 May 2025 13:24:42 -0700 (PDT) From: Florents Tselai Message-Id: <3682F2FE-AB57-4799-A439-7DA518E978A4@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_03B4F205-177A-4179-8FED-4226BEA5B286" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.500.181.1.5\)) Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part Date: Tue, 13 May 2025 16:24:11 -0400 In-Reply-To: <88A95900-E976-43BE-A73A-45AA75A11EE7@justatheory.com> Cc: Robert Haas , Alexander Korotkov , Tom Lane , pgsql-hackers , Andrew Dunstan , Peter Eisentraut To: "David E. Wheeler" References: <145894.1727298237@sss.pgh.pa.us> <88A95900-E976-43BE-A73A-45AA75A11EE7@justatheory.com> X-Mailer: Apple Mail (2.3826.500.181.1.5) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_03B4F205-177A-4179-8FED-4226BEA5B286 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 13 May 2025, at 2:07=E2=80=AFPM, David E. Wheeler = wrote: >=20 > On May 9, 2025, at 15:50, Robert Haas wrote: >=20 >> # We have the kluge of having separate "_tz" functions to support >> # non-immutable datetime operations, but that way doesn't seem like >> # it's going to scale well to multiple sources of mutability. >>=20 >> But I'm not sure I understand why it matters that there are multiple >> sources of mutability here. Maybe I'm missing a piece of the puzzle >> here. >=20 > I read that to mean =E2=80=9Cwe=E2=80=99re not going to add another = json_path_exists_* function for every potentially immutable JSONPath = function. But I take your point that it could be generalized for *any* = mutable function. In which case maybe it should be renamed? >=20 > Best, >=20 > David >=20 We discussed this a bit during the APFS: As Robert said=E2=80=94and I agree=E2=80=94renaming the existing _tz = family would be more trouble than it=E2=80=99s worth, given the need for = deprecations, migration paths, etc. If we were designing this today, = suffixes like _stable or _volatile might have been more appropriate, but = at this point, we=E2=80=99re better off staying consistent with the _tz = family. So the path forward seems to be: - Put these new functions under the jsonb_path_*_tz family. - Raise an error if they=E2=80=99re used in the non-_tz versions. - Document this behavior clearly. I=E2=80=99ll make sure to follow the patterns in the existing _tz = functions closely. Other thoughts and head=E2=80=99s up are, of course, welcome. Patch CF entry: https://commitfest.postgresql.org/patch/5270/ Last updated Sept 24, so it will also need a rebase to account for = changes in jsonpath_scan.l. I=E2=80=99ll get to that shortly.= --Apple-Mail=_03B4F205-177A-4179-8FED-4226BEA5B286 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 13 May 2025, at 2:07=E2=80=AFPM, David E. Wheeler = <david@justatheory.com> wrote:

On May 9, 2025, at 15:50, = Robert Haas <robertmhaas@gmail.com> wrote:

# We have the kluge of having separate "_tz" functions to = support
# non-immutable datetime operations, but that way doesn't = seem like
# it's going to scale well to multiple sources of = mutability.

But I'm not sure I understand why it matters that = there are multiple
sources of mutability here. Maybe I'm missing a = piece of the puzzle
here.

I read that to mean = =E2=80=9Cwe=E2=80=99re not going to add another json_path_exists_* = function for every potentially immutable JSONPath function. But I take = your point that it could be generalized for *any* mutable function. In = which case maybe it should be = renamed?

Best,

David

<= div>

We discussed this a bit during the APFS:

As Robert said=E2=80=94and I agree=E2=80=94renaming the = existing _tz family would be more = trouble than it=E2=80=99s worth, given the need for deprecations, = migration paths, etc. If we were designing this today, suffixes = like _stable or _volatile might have been more = appropriate, but at this point, we=E2=80=99re better off staying = consistent with the _tz family.

So the path forward seems to be:

- Put these = new functions under the jsonb_path_*_tz family.

- Raise an error if they=E2=80=99re used in the non-_tz versions.

- Document this behavior clearly.

I=E2=80=99ll = make sure to follow the patterns in the existing _tz functions = closely.

Other thoughts and head=E2=80=99s up are, of = course, welcome.

Patch CF entry: = https://commitfest.postgresql.org/patch/5270/

Last updated = Sept 24, so it will also need a rebase to account for changes in jsonpath_scan.l. I=E2=80=99ll get to that = shortly.

= --Apple-Mail=_03B4F205-177A-4179-8FED-4226BEA5B286--