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.96) (envelope-from ) id 1vxEBB-004529-1e for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Mar 2026 01:04:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vxEB8-003ntQ-2V for pgsql-bugs@arkaria.postgresql.org; Tue, 03 Mar 2026 01:04:03 +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.96) (envelope-from ) id 1vxEB8-003ntH-1X for pgsql-bugs@lists.postgresql.org; Tue, 03 Mar 2026 01:04:03 +0000 Received: from mail-oa1-x2f.google.com ([2001:4860:4864:20::2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vxEB7-000000006Dq-0YPD for pgsql-bugs@lists.postgresql.org; Tue, 03 Mar 2026 01:04:02 +0000 Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-40f20af93aaso115129fac.1 for ; Mon, 02 Mar 2026 17:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772499840; cv=none; d=google.com; s=arc-20240605; b=B4HkC/Ow0EWtrrJ1Q0x2KXaHtHt6nsAJ5Ij+DNBXuxMYUfFbAY0loIsoaPt4Lu8vV/ 8zI1Oh0OO1fdtEOostUs0qA2iIHnbidVCadQBhoh5yPApxdK65nZjqgMNykYsa/kmkjV qrVxknxNbihhROb66GjZik2/K6AiPzlG+Bk4KaL0GaTDPVElp4uSJlUivBp8lLucfxcW QCk/q6a9qG0IczNZa+VhEZ/6WDNcRJRrmw7mo/W6QJTOF18BewwjQ/H6KPvnFqOtj4Af eNvBw95DBNslzV9ebuTmsGlZGlOHxWXtIXEPcLPgVkhafs2J99l1xpongJ3NlOkwkbw/ UtJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pS2iXu+0UcWsk0OcCHQswrnfNfRhaaFjb0stHaAjpKg=; fh=QTlA9cptGCBb5nz04JVs6WRtyJ9QUzz4aeDyOxzryXg=; b=UiczAVhmp+13FAKmqqfbNbuktmWVjqlLdu/FomxeIBN2YxuxVbP+5AvQmeagfOaXLh FrN+wVPOfdNDCMUsmWrDEVVF5O83t6EYdDb3KXvqTCURLXz80qJS+DvjDhM4deBqGbIZ CKtXGD9vi/hZgymvQT/kXt9fg7dg9jurZ16EyZ/2s+yI2RBnAjUlGqRQ/JkLivjm4h57 FBwJxnaCB8dubl5jV2tnXcJafbRhmN7YzuNodPPmhqn5yzSgJbWqsOPKN/O9uOlO7viz ZZ+TAgIjqszv04p7fVl7k7rFOuebIczqctMMGKs4RHnk+hmdBigZtUf3OE3i2FlbBazp Q8HA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772499840; x=1773104640; 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=pS2iXu+0UcWsk0OcCHQswrnfNfRhaaFjb0stHaAjpKg=; b=jjTICHY7XlDbS9fHlDba9YWkyU15v8MZlbpazQmWVLWY0w2RnckESqiTLYbYniUWmC G9keU4wEd8HWGOfpWdvcmzpS4Lzhnt/iiqvQ8NdOEE1M4Dld5MisDzZh++cE4KMkh4rk dlg4XdSXS/qNzk2GFcsSMFOIlgyRm13tNmYQG8+yFFF5f5RJbd/Bx7CQbjS4LGsaVlJZ Nw4Z2Dy0XByDauPMe/maJkculGgwqPGTy0EPLUNN4SqeuHpmAt1w8PO2sEfB9e1culI6 rWhDff29PHAbhJfx4rMid677pUJOD61jJbGfzAkkEQQTfc6kyOrmFSPv1YbGE6DP2nWh C4lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772499840; x=1773104640; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pS2iXu+0UcWsk0OcCHQswrnfNfRhaaFjb0stHaAjpKg=; b=QVXZ6NW++FeHpNZtqVZIiTu6cUNUCjdkfXJcsm66z8yUlvoh8vAd9A1hcZ3oHAamAb 1SXuUeY+SGaseCcboBWoLExm2w0Gg8tE+sQffWsnh9mPsbysx41kGK7JZeanqpSruVh9 D36TfZzj6csBainP6ZjtRJoQ037t+b548A0GbtzRJPu16icA6JtVKJ4fumGab3W4cPOJ uBha+uTf/x/hfWKX/FdQ81OZVVOK3+azoblkUKqBIHiEr2GWh2udkOIbzA/SVMaMuzUz Itk6i2s7vqh4hG8jdHiuCZgTEx62d9TQ6C/wPp6qCAsFNhd2koByETLR0HF0NmxeJhdQ EARw== X-Forwarded-Encrypted: i=1; AJvYcCV75OM4wDAuJoUibRFolgMieu/L1SPOp/R2e3pSeGGwgVvRJj4xUFf2Pvv12gHgMGZY2Hoxv071SzBb@lists.postgresql.org X-Gm-Message-State: AOJu0YzHV9PmuDMFF5uBjmB3uSO4Usfcm1r/aqs/y4rrAnF1sppwm4H7 NcV7fz4PQHPsoKTfrPVFdPqsr/P62nzhc+UROJ5EVFdwRWlKfnm9iUf8LYczFlM7twOQOLlK3cj zAOE6qSsWLA5ASYwlJn+6iH3EP1NJ58s= X-Gm-Gg: ATEYQzwVLm2d6obndKU/NYwjmh5Q6oH0bKkEmbh89qAFWzKkfyP21A5l9600/kkhAZ9 7vplwmLqRdyFrvrgKlZxRPBQblQM/+kAizdJ2MCkHe/NxrKpm+n33gUamYE0Ul36w1ooiMMAVrS p37jnTc2nnfY7NbXVhrTB9K0obwiNoDVT7LrGzuMiEot/aUsIGWc+9oSwU7EJEYlCaxGLOiL7Ce neGcBBoWLtnRs3aGM+R5QV5BFFNYReoeE19Nha3GXDtrjGjycJzpdq5JPD7PV/ovUiiJHF1QODB itc/ISG/sA== X-Received: by 2002:a05:6870:c26d:b0:3eb:b2db:8db5 with SMTP id 586e51a60fabf-416270f0bd9mr8614536fac.51.1772499840208; Mon, 02 Mar 2026 17:04:00 -0800 (PST) MIME-Version: 1.0 References: <19418-591ba1f29862ef5b@postgresql.org> <2abdb464-27f5-4759-bb0b-f09ab5b5ceab@postgresfriends.org> <501040.1772433449@sss.pgh.pa.us> In-Reply-To: <501040.1772433449@sss.pgh.pa.us> From: Richard Guo Date: Tue, 3 Mar 2026 10:03:49 +0900 X-Gm-Features: AaiRm53OzwOB413zslPiQoNhuDFP7JfCJxqzQEDS1XU2UeDr_W4DEBEzbt3e9xs Message-ID: Subject: Re: BUG #19418: SQL/JSON JSON_VALUE() does not conform to ISO/IEC 9075-2:2023(E) 6.34 To: Tom Lane Cc: Vik Fearing , lukas.eder@gmail.com, pgsql-bugs@lists.postgresql.org, =?UTF-8?Q?=C3=81lvaro_Herrera?= 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 Mon, Mar 2, 2026 at 3:37=E2=80=AFPM Tom Lane wrote: > ... doesn't that point disqualify it from being back-patched? > People don't like unprompted behavioral changes in minor releases. > "This is what the standard says" is not strong enough to justify > changing behavior that was not obviously broken (like, say, crashing). Fair point. Changing user-facing output is not something we want to surprise users with in a minor release. So this will be a master-only fix. > Another point is that the previous coding already failed to > be round-trippable, ie you wrote JSON_ARRAY() but what comes > out in view decompilation is JSON_ARRAYAGG(). This makes that > situation considerably worse. We should endeavor to not expose > implementation details like that. (To be clear, I don't object > if EXPLAIN shows that sort of thing. But it shouldn't creep > into view dumps. We've regretted doing that in the past.) That is a good point I hadn't considered. So I think the ideal fix is to have the parser preserve the user's original JSON_ARRAY(query) syntax as much as possible, and then defer the JSON_ARRAYAGG rewrite trick to the planner, perhaps during expression preprocessing. - Richard