[PATCH] Remove redundant path_nulls checks in setPathObject/Array

From: "Ilya Gladyshev" <ilya(dot)gladyshev(at)linux(dot)dev>
To: "pgsql-hackers" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Remove redundant path_nulls checks in setPathObject/Array
Date: 2026-08-26 12:03:02
Message-ID: bb4175151e040c4b98045d5b01b8128fd923eb1e@linux.dev
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

---
Ilya Gladyshev // foxido.dev

Attachment Content-Type Size
0001-Remove-redundant-NULL-checks-in-setPathObject-Array.patch text/x-diff 1.5 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-08-26 12:06:50 Re: scary patch contest
Previous Message David Rowley 2026-08-26 12:00:20 Re: scary patch contest