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 1stmAE-001W5O-9B for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Sep 2024 10:56:02 +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 1stmAD-006Vwh-4o for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Sep 2024 10:56:01 +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.94.2) (envelope-from ) id 1stmAC-006VwG-RJ for pgsql-hackers@lists.postgresql.org; Thu, 26 Sep 2024 10:56:00 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1stmA9-001B6Q-40 for pgsql-hackers@lists.postgresql.org; Thu, 26 Sep 2024 10:56:00 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-53653ee23adso799156e87.3 for ; Thu, 26 Sep 2024 03:55:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727348157; x=1727952957; darn=lists.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=L6uUbMTMhqdrJNnvwlSLfP7I1yYAXwEVz4R058rGgIU=; b=Tzq24Obhij9uFBp9gtMRgS9fQGVBMiVgEczhP95O1euhWiOfzgTgR0Td0z9/bzHszv TRGY4R+Kz1ksSDoS0QjRNkjPlqn1i1aYFsljOyciAFwf4+Re1yhiqByFo8VSIo+jQcQU 6gvJI6484qhn5Ec7riL8SS9PFabc2sVIqcIAdIu0bNOkidyQP/Y2mW7hiCqKfA6LVBkb JarwHsBHR+i+H1lf/20ZPMt1rqkKle9he/DTF6eC7vkwWxedw/+Fw6VmLwWaYVkEig0V 42N+OmDV2GN2XIKezhjQ3qhvg10zdszCQuTFCSUL1HA30qqeVoPeB86ncLnNZRQMujZM IaQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727348157; x=1727952957; h=content-transfer-encoding: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=L6uUbMTMhqdrJNnvwlSLfP7I1yYAXwEVz4R058rGgIU=; b=dj6GffXnT+sIP6Odi93AJJGHuheEP6x9zpn2E/WGzWkL36Ba60h91Lpwn7a5w16zcN TFpFskW4U4hGXB0aOO+vP0s5WVBfEiTlgTtkEQ/LvCaDwGg/FNOezmE77TNVQEAgRjDF 5Dzw7w977bJwlWtlsFo1x4R6sBDjr8yHoNNcfF0Z6Df61rKjHM34uKL01mBaRRVqVXAh wsQ8flqPrXDZFDiJTBNtinLpCAof2z98wavaFy7HAdEyiavi0v9MHs8PoQmQYIQbPyJ1 iuLwOqovc2e28T07PoWeM3FaF52hWt9p16RNDnobT/UmcypeH7k4uXDtfaykfUFEqcEL n7pw== X-Forwarded-Encrypted: i=1; AJvYcCVwMTMWFRHIHL+b5492dokzNGSdwZbWSG/2gPh/ujG7eq2BypHWTIrj5ZEcFgh7vpYt/jZlxyE16M/a3j7+@lists.postgresql.org X-Gm-Message-State: AOJu0Ywy70xNy48eRtoCmh6bJL1ipynW1Y+yzy5pX8fItmaGGzyTNMbp gXW2sUSGEqNwTy8cW1IMyYIJsOU2nvFQhmFl2MoqjaE3tkr2EwXfdVkwREXj03Fe8V2wenDGEDB UXzxZAPIkohHAsWS5QK1AQzHNgnqI/D5/UsI= X-Google-Smtp-Source: AGHT+IHJuNFZifnqilUpCeCuT7+N6te6w1Qs7AAOTbKRDrndr09+/axaS5Fice+5TSaMUckbqxKKqwU+1RnWfqOvHbo= X-Received: by 2002:a05:6512:b29:b0:535:ea75:e913 with SMTP id 2adb3069b0e04-53877530f72mr3845808e87.33.1727348156496; Thu, 26 Sep 2024 03:55:56 -0700 (PDT) MIME-Version: 1.0 References: <145894.1727298237@sss.pgh.pa.us> In-Reply-To: <145894.1727298237@sss.pgh.pa.us> From: Alexander Korotkov Date: Thu, 26 Sep 2024 13:55:44 +0300 Message-ID: Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part To: Tom Lane Cc: Florents Tselai , pgsql-hackers 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, Sep 26, 2024 at 12:04=E2=80=AFAM Tom Lane wrote= : > Florents Tselai writes: > > This patch is a follow-up and generalization to [0]. > > It adds the following jsonpath methods: lower, upper, initcap, l/r/btr= im, > > 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? ------ Regards, Alexander Korotkov Supabase