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 1x9TM1-000000021HX-1uqN for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Sep 2026 20:14:09 +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 1x9TM0-00000007j5u-31Vo for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Sep 2026 20:14:08 +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.98.2) (envelope-from ) id 1x9TKb-00000007erL-2rIA for pgsql-bugs@lists.postgresql.org; Wed, 23 Sep 2026 20:12:41 +0000 Received: from mail-dy2-x0f.google.com ([2607:f8b0:4864:36::f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x9TKZ-00000000wL4-0uR1 for pgsql-bugs@lists.postgresql.org; Wed, 23 Sep 2026 20:12:41 +0000 Received: by mail-dy2-x0f.google.com with SMTP id 5a478bee46e88-32836aba75fso141212eec.1 for ; Wed, 23 Sep 2026 13:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790194357; x=1790799157; darn=lists.postgresql.org; h=mime-version:content-transfer-encoding:content-type:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=v6olTHnvVRBaKbRuaVA6A42HivRTAbqzB6Mr1e17CO8=; b=kEbMOexhGoIja7+LHYT4YntjgEK3/Oemy48Zi/mFPSYY44Y9kiiqMB0Ky0oogUETOe QkNGWwe3FH6vHl2lZ/2qs+z61LsCZORlGIskm0Ax011kwy3ir6JMjeKX6egXCWnuglTF jJ2JDb/jnz1fUjO2Lp+qyrGH83tHvObLshnAjxheMfjiWLAPKhdm11w5LL2K6OMvZci3 p3UHwbaMNt7oXSE3p4nH6fchGAla+Eo4fxd0ix1G+knyvLGl0uC5jwRy05XqUYp5Okq9 AMWdAK4KwaGU6Rl6Eis6tlz93UaRV1DCqV343jKYFARC2BfoNzz2JSQSfky031eDOwi9 fNDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790194357; x=1790799157; h=mime-version:content-transfer-encoding:content-type:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=v6olTHnvVRBaKbRuaVA6A42HivRTAbqzB6Mr1e17CO8=; b=VzEUg3JS+QMa6LSKb6uKc1DnmST6gj8OutthuukItCOKWIa6mqGjju2ggOwnE1lQQb oJQWGRwug6dihz0Z2JC5Hobw9EB7Z6VUFSSeWtglTAdrXbINH44ysJVV7pQqTiUIBtFJ iyI9nZR5qSSxMQHI6YC2DdAXeI80aZIGfcBP6AYZAVrAOzuk0ReEWoM8tlXRBljddVd6 bU6Z2XI8We0H8wEM5b/uYs3bj6RtZE4EQy9vgl9Tk0BwfIkZc6Ec0udXc8jxb08jYvzM e87SfjUaxqhf2TALFkI+rs/B07owm9aK4Kj/KskCTET67tHrBGDxhLbP5Qt/1X5Tvc5/ lb3w== X-Gm-Message-State: AFuF++m/KAn0E//jHNgEH4iAg49RZiWbwy7h/Tir5CEnsQeq+h12NIAD mheN4PvNe/v83fEbSP15vO5OQtnSWUxXiif05SI0EyLWrxiRm2toarX7kMVMmjKH8BI= X-Gm-Gg: AYBFou1kRMEPmCdR6S17xvIaKdYUdTbEA+ZW9nvL56OPnpovN/0ops8aUib8l8o0cN8 ql+O6b6uMMDwp6sAeRDbvQHLiVSjSo4+AlpnH55VzgUBMZNeX+AACA85pMkfAGBmWL0OMJNxzyQ uvppkEtmFvStg8e+7p4XUbx1bTUoTbzq9VyQk1f+I+fOZJL2AyrJ2ZeWMd/y0p4K8kVeAPvSyZ6 vm9MYoPRXLxWKhckHe9JS3DYLjfxB0Pw2foWZrmOudh56liv6SB7swRuZivSO0ORyQuN3+KRBYb kebCfYojK1SwmVtGFUYmkXkWe6Ms8HWl1QDPI6zohMngYWopvLzi4rDJoLg87y55cq6A8jfGplL i2FMzDfFE7VcIPXp9z9o50LeqdT0m4HyNvY9HAaY8DBQkspIXiXyGZy88SDHstvQfgGeu+NLUkk +Po0vOgOElyzLNAdb2A3mN5Eu7bcFFT1GeqvJUvJ381ks+etJ8srI4v1CzHoibd78tDRqoPXRR1 lJpp84HmtuPyThUSnkKy/z3By6fqHzpo4ZbiKk4ymZJqJLaIpSp2sooOBC3YjqWE4Y8uP/jXOY6 N7ISZJk5uJkTML4C9BiIZ86SlPx/eVWDxhZV X-Received: by 2002:a05:701b:4254:10b0:143:8212:a43 with SMTP id a92af1059eb24-14503fdf94bmr305192c88.1.1790194357208; Wed, 23 Sep 2026 13:12:37 -0700 (PDT) Received: from 192.168.1.109 ([2803:3c90:cee:ea00:5c3c:7e70:29e3:7a55]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-144f986e465sm7991099c88.9.2026.09.23.13.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:12:36 -0700 (PDT) From: Manu To: pgsql-bugs@lists.postgresql.org Cc: Srinath Reddy Sadipiralla , Amit Langote , chaitanyyachoudhary@gmail.com Subject: Re: BUG #19695: JSON_VALUE ... RETURNING jsonb returns NULL for later evaluation once one evaluation returns NULL Date: Wed, 23 Sep 2026 17:12:34 -0300 Message-ID: <179019435414.699921.11893679831783704384@gmail.com> In-Reply-To: References: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Srinath, I tested your v1 on master, REL_18_STABLE and REL_17_STABLE, together with Andrey's v2 for #19621 [1], which touches the same function. Both apply cleanly on all three branches, build without warnings, and the main regression suite passes. On all three, JSON_VALUE(x, '$' RETURNING jsonb) over '1', 'null', '2' now returns 1, NULL, 2 (it was 1, NULL, NULL). The fix looks right to me: that branch fills val_string but never cleared the resnull left by an earlier row. A small thing: git apply warns about trailing whitespace on four lines of the new test in sqljson_queryfuncs.sql. [1] https://postgr.es/m/CAB8bMitawD=3DERVLwYuDXvMT_OJqf+qAKx=3D3GEH6V_WHT7jnq7A@m= ail.gmail.com Regards, Manu