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 1tpuRr-00E4Zi-RE for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Mar 2025 19:30:31 +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 1tpuRq-00315O-Be for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Mar 2025 19:30:30 +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 1tpuRp-00315G-UH for pgsql-hackers@lists.postgresql.org; Wed, 05 Mar 2025 19:30:30 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tpuRo-001A8S-0M for pgsql-hackers@lists.postgresql.org; Wed, 05 Mar 2025 19:30:29 +0000 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-3cfc79a8a95so23877085ab.2 for ; Wed, 05 Mar 2025 11:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741203027; x=1741807827; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=cyXXvuiruOy04flbFy4riqVhYyvnlG4JZ0H+wOGA/aY=; b=G5+HDNzRBNhuAFl2zhHkbr2JP9dowFh82zisotcAeqrxDIYumcef6owTXtRLOP3+Nq 6a85sVQIoM5MWdevcP72uVdnEyvtaBufd7AHdYrDniV7lNmnN8+3ExqqVzdU7FDffO4I jdSt7je3XQVTILeiixgUdTETKnoF4N3SgL8goOCjHjd8wY08nq0O589sf+05tyyJB5wO 67feoOWYsdY9/CNEj+jRoM4zR+yuatKTWHg8v5O4NrL3FTDJ52DPLd/+bpAQCftu45Gm DxcWJqJTLhUUoBbPXiGAnO0mPbJM1wkQA2oNnOrgJJgRkgf/3ZOzRTJh9iajv0TVJkl1 FGCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741203027; x=1741807827; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cyXXvuiruOy04flbFy4riqVhYyvnlG4JZ0H+wOGA/aY=; b=I2GNnbs6fwrczIg5+HIAcLTMXNiyaO0mC1+zxMpMJLsppQC6yh0bKf1VoUbxL89wzs HR/1hQ7WV3FL05x4HZNy8TKuwA4JbOjCPFb+2iMNAAaBF1yiXYApB6u4Ab3JLEegcc8I 8bGy0FnVLBWhTXc3+64H8dyPRhVgeUn119P061n5CDNuPhO0TZYvYe9gEVePyO647mrf wj7O10jIYtnzz1C6iD3tyFXwOk3uyu8NGZOMyCcPvFZ7gUYMxamcQsJ9qS8rv2TPOTsC ZmAI77vJADXAJpofyVY+G2ZwFCjARSvaIQ8WjnsvCErYfinWLCHnTEXqzaKX7G0K2bZE FpyA== X-Forwarded-Encrypted: i=1; AJvYcCXKZIHLYl6eJY94PcN5bFHOW75XCt0fUmk7D8wDDGt11dLFk10XWBivTFOpy5M91AznEOfjsDE9b908y4GN@lists.postgresql.org X-Gm-Message-State: AOJu0YxO8qnsKiY2YLAvp0VQCxGuQyYDr/jjqOWF5vo6sssLyE9CxEbe jys25cS8JK8wQsJI0m7FIiezMQ5m6AW2Is/pDWWHPFtbYDet9U73UJgf5g/PAvz/4N1Z/F010yC 8ENcIdboHIjmFyIgkNz/OWq4MNKE= X-Gm-Gg: ASbGncueWTwvNI1mr3SBltT9vE0F1jpOwU1YfTlWS9HLPYtV4qc2sSwyQqKNaGGkeww 8Kh/jtoDp5dzs1Kv4wApVBbxodsjaIf0pIQnQsifBPi1+w22dQIG3SKs52n5XuOK5kSL4LcF7fm d/Ujpy9kwUBELN7beZG2MdiEt9czY= X-Google-Smtp-Source: AGHT+IHumgqfY5rDE5sAfOkOVY83YbYWa/sXMviChfswV8cM/Vu7samnuvfM8XZl5OFtaQa7X10NeBtzBUm3vz9bys8= X-Received: by 2002:a05:6e02:1fe7:b0:3d3:f27a:9103 with SMTP id e9e14a558f8ab-3d42b87f50emr55275765ab.1.1741203027209; Wed, 05 Mar 2025 11:30:27 -0800 (PST) MIME-Version: 1.0 References: <145894.1727298237@sss.pgh.pa.us> In-Reply-To: From: Florents Tselai Date: Wed, 5 Mar 2025 21:29:50 +0200 X-Gm-Features: AQ5f1JqoVqCrTZWCe1BQWrDyoP4gFY9KyUbclvJmiD3VhpEqCrLXqYALEmd3ZsU Message-ID: Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part To: Alexander Korotkov Cc: Tom Lane , pgsql-hackers , Andrew Dunstan , Peter Eisentraut Content-Type: multipart/alternative; boundary="000000000000eb40c5062f9d6bd0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000eb40c5062f9d6bd0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Sep 26, 2024 at 1:55=E2=80=AFPM Alexander Korotkov wrote: > On Thu, Sep 26, 2024 at 12:04=E2=80=AFAM Tom Lane wro= te: > > Florents Tselai writes: > > > This patch is a follow-up and generalization to [0]. > > > It adds the following jsonpath methods: lower, upper, initcap, > l/r/btrim, > > > replace, split_part. > > > > How are you going to deal with the fact that this makes jsonpath > > operations not guaranteed immutable? (See commit cb599b9dd > > for some context.) Those are all going to have behavior that's > > dependent on the underlying locale. > > > > 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. > > While inventing "_tz" functions I was thinking about jsonpath methods > and operators defined in standard then. Now I see huge interest on > extending that. I wonder if we can introduce a notion of flexible > mutability? Imagine that jsonb_path_query() function (and others) has > another function which analyzes arguments and reports mutability. If > jsonpath argument is constant and all methods inside are safe then > jsonb_path_query() is immutable otherwise it is stable. I was > thinking about that back working on jsonpath, but that time problem > seemed too limited for this kind of solution. Now, it's possibly time > to shake off the dust from this idea. What do you think? > I was thinking about taking another stab at this. Would someone more versed in the inner workings of jsonpath like to weigh in on the immutability wrt locale? --000000000000eb40c5062f9d6bd0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On T= hu, Sep 26, 2024 at 1:55=E2=80=AFPM Alexander Korotkov <aekorotkov@gmail.com> wrote:
On Thu, Sep 26, 2024 at 12:04=E2=80=AFAM Tom Lane <tgl@sss.pgh.pa.us> wrot= e:
> Florents Tselai <florents.tselai@gmail.com> writes:
> > This patch is a follow-up and generalization to [0].
> > It adds the following jsonpath methods:=C2=A0 lower, upper, initc= ap, l/r/btrim,
> > replace, split_part.
>
> How are you going to deal with the fact that this makes jsonpath
> operations not guaranteed immutable?=C2=A0 (See commit cb599b9dd
> for some context.)=C2=A0 Those are all going to have behavior that'= ;s
> dependent on the underlying locale.
>
> We have the kluge of having separate "_tz" functions to supp= ort
> non-immutable datetime operations, but that way doesn't seem like<= br> > it's going to scale well to multiple sources of mutability.

While inventing "_tz" functions I was thinking about jsonpath met= hods
and operators defined in standard then.=C2=A0 Now I see huge interest on extending that.=C2=A0 I wonder if we can introduce a notion of flexible
mutability?=C2=A0 Imagine that jsonb_path_query() function (and others) has=
another function which analyzes arguments and reports mutability.=C2=A0 If<= br> jsonpath argument is constant and all methods inside are safe then
jsonb_path_query() is immutable otherwise it is stable.=C2=A0 I was
thinking about that back working on jsonpath, but that time problem
seemed too limited for this kind of solution.=C2=A0 Now, it's possibly = time
to shake off the dust from this idea.=C2=A0 What do you think?

I was thinking about taking another stab at this.
Would someone more versed in the inner workings of jsonpath like t= o weigh in on the immutability wrt locale?
--000000000000eb40c5062f9d6bd0--