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 1x3Thn-006SOL-2G for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Sep 2026 07:23:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x3Thm-00HY44-2E for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Sep 2026 07:23:50 +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.96) (envelope-from ) id 1x3Thm-00HY3w-1J for pgsql-hackers@lists.postgresql.org; Mon, 07 Sep 2026 07:23:50 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x3Thj-00000003Mer-3f4v for pgsql-hackers@lists.postgresql.org; Mon, 07 Sep 2026 07:23:50 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-2d9b60c652aso38118745ad.1 for ; Mon, 07 Sep 2026 00:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788765826; x=1789370626; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=0z+/cIxei7UGmdSopMF/q87nYa6h5TXGpGvNv3gg+1o=; b=euzcc3okqqWeVF5PWCFy5RgcsFYrKJ1rTm8/YIBGVkZqZZSfDuA7arLwOVi0tJewcx JuWxaFVYTFe8LWhZn9xJWG98YIzmQFvOH4qd58UO9UXFODFGJ3IDrjEGToqsc7YNkzOL qM4MZ9jFPYwbqhuxRH+eYX6hU4LjfRLWhEAl6v+3k2HJJieNLsraYR7yKu5PZm519pTT Ag+DXfFcSO8YiYhumOSYwdo+DX7L6nTiQLmlaehPW/DOqh2OStXPPiwdCPl35YnnQTJV iMp6MBHLEANFnN/xj0c0GMjxp3Y3Z0FhREfA4/Dn4IelbUSTlwyQNZKJDMOuPiYmfwpm G6AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788765826; x=1789370626; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0z+/cIxei7UGmdSopMF/q87nYa6h5TXGpGvNv3gg+1o=; b=GpJTyNkMTQ+9VPtJoYJAbKy8fWuAiG/DFxmhoHrh/E4Gbroot5NK9BZcfkml4B7e9O AVMTsJ7AWI6D6pz3zorAvVcw1DPi9ceSEavtGtfyK4CMDdlKaB+qfKWYG/v3mFYBPOTC /UJsq2Vkgs76Zq3wmiwUGYutRCfMJHUUDXzwC531pJyOMobIHGYqUESAHzym9Va3OHbK tYe3Sg1SqLyjhh8nR0vEJ+tLKQC9tElShjGwiPvF4SuDZB/Bg7Sy8wLEOFRRD0sc0KLD 7qMbXvaG8xozrcNBSllMfPEDtEUdDdEy832kGkiBSONVpXjtH4EHKOQyMY5ifkJ8t1w6 j/ng== X-Gm-Message-State: AFuF++mZEqKSzoXL2eQjkOVfuBXQKyn6LjPU1+afuhvt3LcmaNBpKMEt i95/PFI/hvIXw5S7svQvFJ/ARo9pO8ru51ABYla3UT7Z4g1asKcUsXcr X-Gm-Gg: AYBFou3Kpbbf3O+XqW/4f+rpW/II8e3b3z8yCEoO3/QLymSbt0XsGRPcv90+Gu182Kr LRXZ96xw5uKSRufHNI7uu4P8EiZr9kRUkjqlfGVz+wFmKsYGZ8SQhipyO0InyhGKryXIfPRT4do aX3XxXyYUf9Z3Kx1IPI7Rmuhnlf7UbNy1ijXz26bq8J08RoCVJl5oXeImi5Q+ikTAEZ8Fd7u9zq Wg5k40clCAmIYz2gTlfe5pV7kcoqOCnhgk54LoDYQPIsVQIlFPVQGjxxKgnTpIRize2iOjmQCNA sarXEuYkeSXAaqcaH0aV3tt+r4oNOSNURXZMw0dAsyatbFP9gPdklkHHqFah9OLjlrkSYujzTR6 DRJJUCBYA7nuMK2Z9B3D2dGxWaBxI1HrRNCE+d37ia0lGvDZKhScby/WjhHDwyemFlKOzZRbJ9C gM6XVrmntiWZG8QhKuDryVGNOtxDeJsDg8X5BrALhvK3Q9Fwiz9CFscIgBw2bfXXkDgeBSv12k0 XT/Dtse X-Received: by 2002:a17:903:46c5:b0:2d9:123c:8c49 with SMTP id d9443c01a7336-2db1975804bmr309477815ad.14.1788765825743; Mon, 07 Sep 2026 00:23:45 -0700 (PDT) Received: from smtpclient.apple ([185.135.79.125]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2db1499f06fsm39097205ad.54.2026.09.07.00.23.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2026 00:23:45 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.700.51.1.1\)) Subject: Re: [PATCH] Remove redundant path_nulls checks in setPathObject/Array From: Chao Li In-Reply-To: Date: Mon, 7 Sep 2026 15:22:53 +0800 Cc: pgsql-hackers Content-Transfer-Encoding: quoted-printable Message-Id: <56F71416-E3C3-4758-81B7-BA9FA32D3A98@gmail.com> References: To: Ilya Gladyshev X-Mailer: Apple Mail (2.3864.700.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Aug 26, 2026, at 20:03, Ilya Gladyshev = wrote: >=20 > Hi all, >=20 > I noticed redundant path_nulls checks in setPathObject and = setPathArray, > so here's a small refactoring patch to remove them. >=20 > - Both checks were introduced in c694701 (12 May 2015, "Additional > functions and operators for jsonb") with the functions' initial code. >=20 > - Both functions always had a single call site, `setPath`, as they are > internal implementations for the two cases (array/object) in a = generic > function. >=20 > - Later, in 1edd4ec (4 Oct 2015, "Disallow invalid path elements in > jsonb_set"), the path_nulls check was propagated into setPath itself. >=20 > If desired, those conditions can be transformed into Assert()s with a > comment about setPath() validation. >=20 > --- > Ilya Gladyshev // = foxido.dev<0001-Remove-redundant-NULL-checks-in-setPathObject-Array.patch>= Looks reasonable to me, since setPath() already checks path_nulls[level] = and raises an error for a NULL path element. I think this patch does more than just remove a redundant check, it also = eliminates a potential source of confusion. setPath() treats = path_nulls[level] being true as an error, while setPathObject() = currently treats the same condition as an indication of done. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/