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.98.2) (envelope-from ) id 1xJoPi-00000000Seu-0QrU for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Oct 2026 08:44:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xJoPh-0000000ACjR-2dtB for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Oct 2026 08:44:41 +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.98.2) (envelope-from ) id 1xJoNf-0000000A9EN-0zPN for pgsql-bugs@lists.postgresql.org; Thu, 22 Oct 2026 08:42:35 +0000 Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xJoA0-00000000N4K-3vuf for pgsql-bugs@lists.postgresql.org; Thu, 22 Oct 2026 08:28:30 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id AB0C8EC018D for ; Thu, 22 Oct 2026 04:28:27 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Thu, 22 Oct 2026 04:28:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1792657707; x=1792744107; bh=SJ+AEU7EN/ 5O6DrpVl1Yt+10WmmKeKozim1PJtVgYgU=; b=awm9KPvoZlqOD+2ShIa7ek2Xc6 F7igrmYSEOvXmS9cTxpokKjZCneaEZhdI/cg+OVskpz48pSe3pIcfTGK6FFVnu5q FU6qVHYmwCDJk4qog/h8K2e2r7+bFr5AOJFmwjE7Ci/PiPuYkGQzezwuzK9CNDjO 2dLVnps3/y8CnGkTSDsIb6oqFO7lMRzsrPi5NOYl6OTMMa+RVcrmaEL5yBbhnYcp vcBioblzD4bIOMrwlwjtdOvlQiuYGAs/TbZkTMn2QlYECpUZuTkJ5ib4fQqVZ373 q35A18lS9ph3zw6eDnwppTT31pumaHAwTUdcLh83FskSsJ2JwuIeSAhVnLqA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1792657707; x=1792744107; bh=SJ+AEU7EN/5O6DrpVl1Yt+10WmmKeKozim1 PJtVgYgU=; b=MhovKiKajReg5iN59pICuijIqdw6u8kNemK3eYxrM8F9VrOsGiH iUt23Sm6uZBe9pT0/sIh2oag/hI6Zn2pxFzkbjNFWj+WYwaGDzV6QwtFb0FwlIQ4 r3BukEUZife1I91Z+bHJW7bpeoVagCWLrW58PwtUW5pamhriK68dpuIqBOJzpW8F XASfuQCoL1rR3Cps0Woorky/ZmMHf+UExddynkY/o5revSWhugWGgyGKPOGlAtPn W4wR6eH8nVPn+j9WBbOKG/1FOafGo8t3cWHIV43/iLL0JW/L9tcGPMxoJi/Qkhf4 jFRq61ezC9hycVt/EUj3TNCTGPGgiZlsQfA== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-07; repo=github.com/dkim2wg/interop; date=2026-10-18; sw=lmtpprox; action=sign d=paquier.xyz a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1792657707; d=paquier.xyz; mf=PG1pY2hhZWxAcGFxdWllci54eXo+; rt=PHBnc3FsLWJ1Z3NAbGlzdHMucG9zdGdyZXNxbC5vcmc+; s=fm2:rsa-sha256:pvl0U1VBr60qh46Yy+RgQg2zXAUdlQ9YewwjE313aKiVKRU apHIzUENjVE7ksvTnQ1Zdub6K83EH6x3EmoaTsKKfGgIeD2k5arBY6sBQnGQiLep d2C10qS63CskHpye8U0ZqNlVqftCMml4wyoxQSHqP92vhZp+L5VTx0fKwgQN1rL4 37hEbhSGpAbpb/giAEgtMrxURPpAsH/VQxdRs2jSL314D3lcCE+md22iZCqV1USL Ujy8N9isZK1oFishfo3LNrwn+Mcj1zwjdXQqwHAGR0ip3JPdBYjAWkGIekRBvN4g jn76s9DeEedP0jVxhwb/8mWJ5mxV4v4hXAbVKBQ==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-07; repo=github.com/dkim2wg/interop; date=2026-10-18; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:kX25WuurX10BpfgAdLAYF6f5IEPj1EzlYIEjmW884z4=:WmJZs7q+U19FZ5KA1qjsabTvTOyt2ur2MuwJshOKHcs=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTFxgem1J/jel9p7h+6y6hnWO/migWA9bcH9O9R9olMhRRwQbg4J3QLPouga+G1KLd 86ICHszpQlqGJC0exthj5TBH1ZaawabFHQwE2H+jtyFefgL4vkU+wWGpy04myNDzGQJqUy JIwBPZetMtW3r8tQRMd0RXTe0cvA23+LAwYhHlAdqAFzd1GXVlF8dBEfX9pgzYYljE5Dxr zViFzcuEahoOxh+UtryjSK9IdkbONDu3XCvszOdczMGU+UUXrowbXTKW9olstIuUOMmJYD uVFGPv3NLEw2dcHpaYGQ9IPueEttxFWTsPCwWKqVDb9fffiWvU73kc04Ue/77vzI4k7kcm VVneqO6lBoTzpTCBAg1psH8Qh1yC7jCSKoLQHgLPqTb/Reovaw/33yVSUFZOldw44jbsrl rJVfZ/gvU+6z7oGOuxFOe1KuQIpOLrL5Xxpt9agky3pfi92rg/fTHc2O/3bXgaNbSF6jN7 45+3VPvAsOt6SfORZZcFr0lEUYw7Hn/liIPZG/HtyeSdGkEzTPAtGGPXi9tlFZ7BjDVtD9 +MPHMybOvJK6JT8zKpbaFT1xe7GiPmnS1ZlqmSnJWAFjaDa2Z3q1nWAOcapeGuoNywOB4b 88LUPPQZkzpYcjWv+Q/ZDKq36Jie5qqHBJFpwGVX1Isvz7B5eM62SajSV86w X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Oct 2026 04:28:25 -0400 (EDT) Date: Thu, 22 Oct 2026 17:28:23 +0900 From: Michael Paquier To: Staroverov Ilja Cc: Sami Imseih , "pgsql-bugs@lists.postgresql.org" Subject: Re: pg_stat_statements replaces SQL/JSON ON EMPTY / ON ERROR keywords with parameters Message-ID: References: <457969A9-5D24-422F-B09E-F388053DE028@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="XBmQQYqTayc3Bsxy" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --XBmQQYqTayc3Bsxy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Oct 21, 2026 at 09:04:09AM +0000, Staroverov Ilja wrote: > Agreed for 0003. 0002 changes neither: it only leaves the location of > the behavior Consts unset, and locations are recorded, not hashed, so > the query IDs stay the same. But it's your call whether that's worth > back-patching. v1 offers a nice coverage. I have noticed a couple of holes here and there, but globally that was fine. + 2 | SELECT JSON_VALUE(js, $1 $2 ON EMPTY ERROR ON ERROR) FROM pgss_sqljson_tab Urg, yeah. In this one $2 is a DEFAULT keyword. That's confusing.. Sami has mentioned that on another thread. It does not prevent doing something with the tests first; query jumbing can sometimes feel tricky to feel (not be!) right. + 2 | SELECT JSON_VALUE(js, $1 DEFAULT $2 ON EMPTY) FROM pgss_sqljson_tab + 1 | SELECT JSON_VALUE(js, $1 DEFAULT $2 ON ERROR) FROM pgss_sqljson_tab These ones are separated due to the different last keywords, and perhaps more arguable, but it's confusing to replace the NULL/DEFAULT/EMPTY by dollar parameters. And we have quite a few more of these incorrect patterns. These SQL/JSON patterns are so various that adding a mention of the defaults is a good idea. I've expanded that a bit more. The ON ERROR and ON EMPTY patterns can also be combined together in a single query. I've added more of them. under NESTED, PATH is optional. Having patterns where it's gone seems necessary to me. Similarly, no NESTED in a PLAN is the same a no PLAN. There were a few more patterns that were not treated in plans with combinations of UNION, INNER, CROSS.. Things like UNION/UNION and CROSS/CROSS included. And a few more notes for things missing: * WITHOUT UNIQUE * JSON_ARRAYAGG(ORDER BY [DESC]) * JSON_TABLE(UNKNOWN ON ERROR) * JSON_SERIALIZE(FORMAT) * PASSING in JSON_QUERY No backpatch can happen on that, I am afraid. The query ID stability matters on stable branches, even if some if the keywords are currently eaten due to the locations. -- Michael --XBmQQYqTayc3Bsxy Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmrZyScACgkQnvQgOdby QH2ClQ/+Ma7ZDTkpYYvZ6sEHLCCpvLl52ZKGJd1jImQMqulmJn8y2rHTiYYJMeKi fxCJH3uykvG0Nx2Jyc42iDTqF5uicMAiJPNQsnSbNfJWD6ECdIclaWd2vTF6abh4 0ca1KSzjeLOXnpO1Jj7B3OnvQwn8b0cRJNWx0hgK3CzvZW3ijr3k+w9Yj3rDdbl+ WT50G29ObnZYD+zw2KSHJz8crPVvKpkxMU8VhdYwxaeY0ojiTvQhsGxgRQkAS3Qc tAycueGHCW5eLTOo/11B04+YTj0roWweyq9D7ScI9PAnz8Uakq7nhua2acqidcHR Bl1mJ+c//Cg8h2dQeYDz2Dni8lmPTzEHg/d0F3PZ2Sg7TJWEH67aadmLTu6V9oZA kbtW9+V3xG1nrLjYbbac92fbnwnJfRWxe8RUCIcii9pyG+fu+k0/W+zxTVbwpnLi y4m0rZ50R4C1c8Q+rE0PKGEh+16DK7LGRQDCLpJvFUbXhGTvySPI3EQp4VdERikc 7IudoVnBC+Zejh1DLsH2Vg/+qnigTk4A0BbWRB3O6lBpvzNBrSMKjI43XQPvcUXf OQbhsLA2QXqez7HUn97lYOy9XlUn0ezGzgaVzbuVygjemTa/I6rMJytNGPDsDqxb XiBT/L0thV+hpzldCzX0/Noq+aM0Z9KgFlRP8AYVAb6LuDqJL+0= =Jgwz -----END PGP SIGNATURE----- --XBmQQYqTayc3Bsxy--