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 1uJ2no-00FeW4-0V for pgsql-hackers@arkaria.postgresql.org; Sun, 25 May 2025 04:17:36 +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 1uJ2nn-00FLsM-8S for pgsql-hackers@arkaria.postgresql.org; Sun, 25 May 2025 04:17:34 +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 1uJ2nm-00FLsD-Ta for pgsql-hackers@lists.postgresql.org; Sun, 25 May 2025 04:17:34 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uJ2nk-000mqZ-0I for pgsql-hackers@lists.postgresql.org; Sun, 25 May 2025 04:17:33 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3a4c6c0a9c7so744465f8f.3 for ; Sat, 24 May 2025 21:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748146650; x=1748751450; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BuC5PXSAApoVMmpOh3JVgUqmHpHZ85apHImHFyQlv1k=; b=i8PRc7TQNYBkOzq0jcksD6LiIORN+KCOhCAvC/n3MTmbi8lR/L+Dgd+m+FwFR0rGyz ErAaW5pfXAL/1WL3QHG3eM/tU9B141lYawBCJVhJZKnvCvOfrEWjhF1lgoRyYEzsuMn3 FHB0TnI3pdCXzUai/5EmkZ3upcf0yVDT/F+66ifFBJ9zI7fTMwLv5JJzhYXtXap9dQqa KMh2Z7/yyZGJQ4JO9U0Wx9h8ITdPd7y3L3rQ6EpyCLF3xUfY9xJLQKx8VgodIpnnNb9E XRu9gu8rpax/8oXnVBKeR3KMcQV1SMUbGQzQyxuHHNRETwGRFCUp+ld+R9WLOhM2P6RK iPdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748146650; x=1748751450; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BuC5PXSAApoVMmpOh3JVgUqmHpHZ85apHImHFyQlv1k=; b=TurR+2d5rafSh7xX79oCaJEklYpToBiyNT6MJi9E0E4jKKENnfWNYc6hqDH3dcVnAA IXvtW1XiB7cSyfYDsWGlqHuxGBBudpUdYz1Ajs5hpFHyj2w4o5gZoeEtz3KTqHNa6ysk gBMw3OxGbX7bm06/NJi8wSNuvDlSpDsqhBCfl5KGg//2amKVG6ZjNg6wkEdqVzMRfoID AkVgztbUVYBydl8tBetHuP57eLRdjmgoZcDsxa9ix6NelFUWl26c3fC1Ovh1Qq0IS+8T jyFkzArGJogkYVMwgK39zBjMx+qTk83ZQCrI6maUpp+spWQRftdyAUo14VR9kknoivu4 65sA== X-Forwarded-Encrypted: i=1; AJvYcCVtw9f5vaq7BUyErWgjEECZZ/fjKvzHjrgrAkTA4GTF0nGRJF0y79H0EAr91mwHCjZSwl0h6NBYwAANATxU@lists.postgresql.org X-Gm-Message-State: AOJu0YykYEM8b61SRJiuA3czfv3IT+dHTkwKEGKAkpc/Sq8OHHpK4hKD duFBEpYZ7BB+BbelU0YBmmxExPwkrb/f4AHAonfJXQnaUBdvkNI1PGt3ejvt30o7in5LRA== X-Gm-Gg: ASbGncvihSphTde2AWgSJEwZ8BJ2YcGxHEI5pQo0gVQepRBudS35klKf6fwZDbCzIeu QIWsNf5uC7FabfkZT9vwiGXnVId8R0gvCmDBoofnu2+b/z00U8PuRvccZ6X46timCUou/4jh0ic awe3rjLUt1sz6yN3NM+FEHMJQTt97HpHCTcY59dq5ddw6A0IDoUhoBUQp4M32Ipj38aRPOytF+A Iha6H9jJWukiZ03hpMIFtWdNA/xd55cmjfBw5WqWak1BdTVbTyS7PBIRJuk2mPa2jT/KTc/sNDy HeNavULuOOBLbvZGuG2qZQShYUIZB4zLZm7wCtJkWa+AwZ4WC/Z5E5l0qq+uyXQGdWnv5wF3YDF rAE7eZipP2+PIv4XH04035imYY949Vg8= X-Google-Smtp-Source: AGHT+IGs17iUC3bQBuf5tKEIyvjceMhdFOgSrG7mJUxlWcsNS20WdJTev8h8k8Zi5j6rGRFi6Xnudg== X-Received: by 2002:a05:6000:3108:b0:3a0:b521:9525 with SMTP id ffacd0b85a97d-3a4cb461165mr3115633f8f.1.1748146649472; Sat, 24 May 2025 21:17:29 -0700 (PDT) Received: from smtpclient.apple (adsl-138.176.58.226.tellas.gr. [176.58.226.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-447f1825193sm205189685e9.5.2025.05.24.21.17.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 May 2025 21:17:28 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part From: Florents Tselai In-Reply-To: Date: Sun, 25 May 2025 07:16:57 +0300 Cc: Tom Lane , Peter Eisentraut , Robert Haas , Alexander Korotkov , pgsql-hackers , Andrew Dunstan Content-Transfer-Encoding: quoted-printable Message-Id: <696ECBBC-3CBF-4522-AE66-E48225688E93@gmail.com> References: <145894.1727298237@sss.pgh.pa.us> <7e9debe6-4e96-4b0d-a801-b531e962ef43@eisentraut.org> <01DC1C38-0692-461B-AA63-5394330356BE@gmail.com> <2568904.1748022721@sss.pgh.pa.us> <40912112-7FFE-400F-A38F-368827C4BDF1@gmail.com> <176C517D-2DEB-4CAB-9AE4-261079D313B9@justatheory.com> <8FD5F4CF-9059-40C1-9F0A-C3CBA8DFE17A@justatheory.com> To: "David E. Wheeler" X-Mailer: Apple Mail (2.3826.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 25 May 2025, at 1:01=E2=80=AFAM, David E. Wheeler = wrote: >=20 > On May 24, 2025, at 17:55, David E. Wheeler = wrote: >=20 >> And now I see my patch broke the grammar because I left some of my = fiddling in there. Apologies. Here=E2=80=99s an updated patch with the = updated keyword map, too. >=20 > No, really :sigh: >=20 > D >=20 > The most important problem in jsonpath_scan.l now is the fact that I = broke the alphabetical ordering of keywords in v2 , and you followed that too. > I'm curious why you added the `arg0` and `arg1` fields to the = `method_args` union. Is there some reason that the existing `left` and = `right` fields wouldn't work?=20 The left-right ended-up being more of a brain teaser to work with in = jsonpath_exec. Until before these methods, the opt_datetime_template was the only = argument passed in existing jsonpath functions,=20 So initially I used that as a template to add to the scann-parser infra, but then realized it may make morese sense to have a way to access = indexed-args. IIRC, with an eye in the future I found it much more convenient - less = of the to work with indexed-args. I should have gone back and use them for *TRIM_P too But you may be onto something with the split_part thing. > The existing string() method operates on a "JSON boolean, number, = string, or datetime"; should these functions also operate on all those = data types? You mean implicitely conversion to string first? I don=E2=80=99t think so: I=E2=80=99d expect to work like = =E2=80=98$=E2=80=A6string().replace()=E2=80=A6' > I'm not sure how well these functions comply with the SQL spec. The fact that Peter hasn=E2=80=99t raized this as an issue, makes me = think it's not one