Re: [PATCH] Remove redundant path_nulls checks in setPathObject/Array

From: solai v <solai(dot)cdac(at)gmail(dot)com>
To: Ilya Gladyshev <ilya(dot)gladyshev(at)linux(dot)dev>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Remove redundant path_nulls checks in setPathObject/Array
Date: 2026-09-07 06:24:58
Message-ID: CAF0whufnu5TNXQOMDBf0zsYbFz5q=+qLFOhv69vf7jk6W4TK6A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

On Mon, Sep 7, 2026 at 11:12 AM Ilya Gladyshev <ilya(dot)gladyshev(at)linux(dot)dev> wrote:
>
> Hi all,
>
> I noticed redundant path_nulls checks in setPathObject and setPathArray,
> so here's a small refactoring patch to remove them.
>
> - Both checks were introduced in c694701 (12 May 2015, "Additional
> functions and operators for jsonb") with the functions' initial code.
>
> - Both functions always had a single call site, `setPath`, as they are
> internal implementations for the two cases (array/object) in a generic
> function.
>
> - Later, in 1edd4ec (4 Oct 2015, "Disallow invalid path elements in
> jsonb_set"), the path_nulls check was propagated into setPath itself.
>
> If desired, those conditions can be transformed into Assert()s with a
> comment about setPath() validation.
>

Thank you for the patch.
I reviewed and tested this patch. The path_nulls[level] check is
already done in setPath() before calling setPathObject() or
setPathArray(). I also checked the call sites and confirmed that both
functions are only called from setPath(), so the checks removed by the
patch are indeed redundant.
I didn't find any issues with the patch. It looks good to me.

Regards.
Solai

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2026-09-07 06:34:19 Re: SUM(int2)/SUM(int4) do not detect overflow of the int8 accumulator
Previous Message Koshi Shibagaki (Fujitsu) 2026-09-07 05:49:55 [PATCH] Move pgcrypto's fips_mode() function to core