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 1x9TKb-000000021Gn-2Mbt for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Sep 2026 20:12:41 +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 1x9TKZ-00000007elQ-1xRz for pgsql-bugs@arkaria.postgresql.org; Wed, 23 Sep 2026 20:12:39 +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 1x9TKZ-00000007elI-0uvt for pgsql-bugs@lists.postgresql.org; Wed, 23 Sep 2026 20:12:39 +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 1x9TKW-00000000wKs-336r for pgsql-bugs@lists.postgresql.org; Wed, 23 Sep 2026 20:12:38 +0000 Received: by mail-dy2-x0f.google.com with SMTP id 5a478bee46e88-32836ab4521so157465eec.3 for ; Wed, 23 Sep 2026 13:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790194354; x=1790799154; 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=TiLSX7099nfN5P2SzfXk6r7QNU15ERAaTFWobMo8Rq0=; b=KNJRyBtv0P62LhkKghi1c4Mxf31CO7iRMvuWbIMNpfC7vaqqEyCnbBbVA04shUweDR B2fBH6yHI529I+dS90IiJhtx3Wey12KmTAw+ehVuTYr3sNpvdAoZ1EiYj/xtWjH9LQv2 gFhRhwrIrDdpRetq1YRne3c72AXpimKVoT8kHD/HSINYsVeO2yPCHdKvov1i5zYXMl0f cvMrrf275gvaqe5giijGdKxVVE+zXlbrQhx/JJ/8FHRG9N0WH9Mk1R9c3qD7vzo9uUo4 GRQ7kQ6F8JL1ukm+OIE88h1lRAH4D6BaaU4iK3zMqTHVPVIV1NwOZdHFxol8wKwy07Av 2h8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790194354; x=1790799154; 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=TiLSX7099nfN5P2SzfXk6r7QNU15ERAaTFWobMo8Rq0=; b=u8cxweplSm5oXCQHDS/DPfi/8Up0EujJWVIZc3Gaon9eeTvZf3tP5wSyBVUzLDxXHk y8OOrnRB5knPnjGUl0QSP4K/28AbvSC2xWoHo/IQBzKLsK+fVlMai3Xzo0lg0/bFZnHJ j9LeQQjsmO7+K58ax+TllDEmuITmw87nfn4GzASMuKat0jgIYknE0j0KAcDxpqKeiAu5 DzPcEoLQpNGI9oaOx366dOHIwxgDMM/t05njjuLjuwZEazSLnhrmuR6qM6hjHu3YY7yc 82dWREmn/uNhjpn/1PPKUxzyEbM8Dsles3IddjpDW50zJkyVI+1jvb5uY9gPkYW1byy4 w0Iw== X-Gm-Message-State: AFuF++lHOZJLw04bC1OTxokQXN9cOvYG9b7PCjlUcTHSc2sKLRfIH/hi fjRHgQFMEf9E94s1ppzo7nrXg0MepqYTefgk3sT9Auo4geBDo2Vl+88QtLGGvR1frWk= X-Gm-Gg: AYBFou3OJ2qwu4cZew6GYrdzkfBcIFlEgYPpamqiUJxD8VaaYk84OOdeK4xhFklaiow rMMcjaVq3aCUSkvWbliK3+KYfVtrJD7tFPNaJxPYP412K2TO6qX4ZzcntvofZCBbT4KLeYh8v0Z Tr1kgJHhXg8DSOC+6AXgGmbWiZpM5gET5PynVUq/YIqssIfVM9IJ86IEmbZc3ffIzXXd2q9yM7A 6kloFknVkHtcrLAyi7dDrCr4TeBJ7mPedfn/va13mbWNaO0S6DKMvQpQzfQ4/pB17bQ3cBb9O4J 3hjbRywxuOk9Klg/tWm/TAkJZSHjnsQwl4AXP3pt9oCRjoq+/k198sr/ObqT+nMB9AsWb3nHosD h+hZ/5go7QHoRfJtGXNzrXo159fG4foXhSLOXaGwuxPUdnhR6mh6UArbwfzRt8Pxw1FfNPpgJoB /dSJfjqejSI/s25aEEdyKq829nMTiMp+CgHAeXL6Fkhsdyv3LfbQbvrBSRpPxWje7geTP68psOj mJRd3T6CB5eQKJxbr40QSygijhT4VdSJ4ufGpsx6F0O/trjhM7s4ycVGBcq26xf/N1oT0i/1sNw 0jCBIS/88cZSjE0ZNxYkxIE9/Q== X-Received: by 2002:a05:7300:d58c:b0:33e:4ccf:ed68 with SMTP id 5a478bee46e88-33ffd93f425mr378482eec.0.1790194353517; Wed, 23 Sep 2026 13:12:33 -0700 (PDT) Received: from 192.168.1.109 ([2803:3c90:cee:ea00:5c3c:7e70:29e3:7a55]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33e95c7d003sm7395347eec.9.2026.09.23.13.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2026 13:12:32 -0700 (PDT) From: Manu To: pgsql-bugs@lists.postgresql.org Cc: Andrey Rachitskiy , Amit Langote , syzhong16@gmail.com Subject: Re: BUG #19621: Unexpected results of JSON_VALUE with DEFAULT ON EMPTY Date: Wed, 23 Sep 2026 17:12:30 -0300 Message-ID: <179019435072.698927.9020965732916209558@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 Andrey, I tested v2 on master, REL_18_STABLE and REL_17_STABLE, together with Srinath's fix for #19695 [1], which touches the same function. Both apply cleanly on all three branches, build without warnings, and the main regression suite passes. The reported cases now give the right answer on the three branches: - #19621: json_value(x, '$.a' RETURNING int DEFAULT 42 ON EMPTY) over '{}' then NULL returns 42, NULL (it was 42, 42) - #19654: json_exists(j, 'strict $.a' FALSE ON ERROR) over '{}' then NULL returns false, NULL (it was false, false) I could not exercise the llvmjit_expr.c part: this machine has no LLVM build. One thing for the back-patch. EEOP_JSONEXPR_RESET is inserted before EEOP_JSONEXPR_PATH, so every opcode from there to EEOP_LAST changes its value: 24 of them on REL_17_STABLE and 25 on REL_18_STABLE. On master that is fine, but the back branches are under the buildfarm's ABI compliance check (.abi-compliance-history), and anything built against a minor release that uses those values would be off by one after the update. Putting the new opcode just before EEOP_LAST in the back-branch versions, with the dispatch table and llvmjit_expr.c following the same order, would leave the existing values alone. If you post back-branch versions, I will rerun the same checks on them. [1] https://postgr.es/m/CAFC+b6p8Oo3_pLXPa=3DDVXx1XDQJ09b2W3U3WKPtkQYyh0z0z-A@mai= l.gmail.com Regards, Manu