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 1uDTk6-00BNOl-5u for pgsql-hackers@arkaria.postgresql.org; Fri, 09 May 2025 19:50:46 +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 1uDTk3-00EOQR-DD for pgsql-hackers@arkaria.postgresql.org; Fri, 09 May 2025 19:50:43 +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 1uDTk2-00EOQ0-U3 for pgsql-hackers@lists.postgresql.org; Fri, 09 May 2025 19:50:43 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uDTjz-0014qZ-2I for pgsql-hackers@lists.postgresql.org; Fri, 09 May 2025 19:50:42 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-acacb8743a7so408840366b.1 for ; Fri, 09 May 2025 12:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746820239; x=1747425039; 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=ivFdO8Q43eV7aJ6A+hsU6uxedyh8R/unXg7EMljj5Xw=; b=l5VKH5Y4z3o+8aZBxMj1ozcKxohjY4vsQjbjXKtilQBXNVFx2P7jRD0IRRqUOV2qx4 Rtvm7TDgJJRwqZyF166uhGrBGk8Gsr04u2jn7tS/ESke6vHBVf206opaXvTErUSUz7hM ChSgsIuut06xMxpayuk7fRpJbkmoA33VDMl0PrEMaLh0tWLg3RU2jrvxRqeVUrJDvoyK jbKetZ164fWrgwC0/bjE444ljkmplBivlOp/ybxu6865E9sClAg8ebiVIZlM3itcPxxF aDUPeJImL8PnBQOPbjE8ieuTi0O2sIWbFhIWf2mp4F1KB/aBFWhFDTQy46uOdiyoMIXn 3E7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746820239; x=1747425039; 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=ivFdO8Q43eV7aJ6A+hsU6uxedyh8R/unXg7EMljj5Xw=; b=sdRTkTiShkRi5+XA/a6ycUsjFFNpekGqyCpRad4DTkkX2LrIyT/NVaNIZwUiATA0Ce Q6Xg9fnBPPFWvtP2K1aBDBPFIJy3Mt4K/SKNzyPgrJ4LP4jMyDj62SJU8xqw2mth3TYC cXeaN5Bl5UrxcVNZikyFXUL/WB079vKcmt0G3GPNOQqbGyppnJRapmFO6+V4WYjOtmbZ bpuG/9QQsdvbuYQMa51UmC3E39eC0/lRwBSOBLYfzZwkYjndQX8rU1gVd1SChB+ei9SC ZhxyiUKOLBs2RxtSG7Q3InBCUKqfH1cKlL4wqWJp26sXKxa5inDLK8mkthpZZcMnF8HR HQPQ== X-Forwarded-Encrypted: i=1; AJvYcCUq+zWTdgvShMk897PV25UD+nEUx5zTUHXS9zBjFwU2m2BHiH6kDTCkUItCO/9QStJ9T/mtIC2p3KvlgNxu@lists.postgresql.org X-Gm-Message-State: AOJu0YzyofK7EKEAlSRhYQRg+E8g3/bRn1v6/Gx6by4BlUTHviBDT6MB VhId+YZMMNwbl+LZlg3c+uASAl6pipz1F9+NIl/uBm5adPKvYPUZAq1a8Sqokh62FPTYD3+FhMA NR2CmdVPUcEzWEKEbzfqouF8NTiWm9oPx X-Gm-Gg: ASbGncswcANx26bOomooGL7mrE8BSPLJIOOgQJ5ZzFCfUi3RLRMPnsh95pRLq3zc2uy nxncD9WeiQFsHGsWdkaGiMHavre4v9PoNFFElMa8yagTeM7hoXFFsWiW8bZiSakTZ8Od9y2thZA A04f1Hgo3C5r7jtWPLbQ3hMrLdCXiGJl44 X-Google-Smtp-Source: AGHT+IFakVOFPv+yTvXcFv8xH6OLMVsQjKtmxjdxr1IdFmYwTnJvr89bNUDhmdPAIlvkN7174QoQfD5HcO2at3N+MJo= X-Received: by 2002:a17:907:2683:b0:acf:dca5:80f7 with SMTP id a640c23a62f3a-ad1fccfe3fdmr824864366b.26.1746820238893; Fri, 09 May 2025 12:50:38 -0700 (PDT) MIME-Version: 1.0 References: <145894.1727298237@sss.pgh.pa.us> In-Reply-To: From: Robert Haas Date: Fri, 9 May 2025 15:50:27 -0400 X-Gm-Features: ATxdqUH2YoqS5YWzf2HwKf_fqn1yW30z6qquweSptr28ZH5rO2SFH1s_uynAQNI Message-ID: Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part To: Florents Tselai Cc: Alexander Korotkov , Tom Lane , pgsql-hackers , Andrew Dunstan , Peter Eisentraut 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 Wed, Mar 5, 2025 at 2:30=E2=80=AFPM Florents Tselai wrote: > 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? I'm not sure the issues with immutability here are particularly related to jsonpath -- I think they may just be general problems with our framework for immutability. I always struggle a bit to remember our policy on these issues -- to the best of my knowledge, we haven't documented it anywhere, and I think we probably should. I believe the way it works is that whenever a function depends on the operating system's timestamp or locale definitions, we decide it has to be stable, not immutable. We don't expect those things to be updated very often, but we know sometimes they do get updated. Now apparently what we've done for time zones is we have both json_path_exists and json_path_exists_tz, and the former only supports things that are truly immutable while the latter additionally supports things that depend on time zone, and are thus marked stable. I suppose we could just add support for these locale-dependent operations to the "tz" version and have them error out in the non-tz version. After all, the effect of depending on time zone is, as far as I know, the same as the effect of depending on locale: the function can't be immutable any more. The only real problem with that idea, at least to my knowledge, is that the function naming makes you think that it's just about time zones and not about anything else. Maybe that's a wart we can live with? Tom writes earlier in the thread that: # 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. --=20 Robert Haas EDB: http://www.enterprisedb.com