Re: BUG #19458: OOM killer in jsonb_path_exists_opr (@?) with malformed JSONPath containing non-existent variables - Mailing list pgsql-bugs

From Nikita Malakhov
Subject Re: BUG #19458: OOM killer in jsonb_path_exists_opr (@?) with malformed JSONPath containing non-existent variables
Date
Msg-id CAN-LCVPiBi9XXW__RorX=dH2_fANAMXhdbULmHFFg97F_0ubRw@mail.gmail.com
Whole thread
In response to Re: BUG #19458: OOM killer in jsonb_path_exists_opr (@?) with malformed JSONPath containing non-existent variables  (Andrey Borodin <x4mmm@yandex-team.ru>)
Responses Re: BUG #19458: OOM killer in jsonb_path_exists_opr (@?) with malformed JSONPath containing non-existent variables
List pgsql-bugs
Hi!

Sorry for the late answer -  I missed this email.
No objections against backporting error throwing code, sorry if my explanation
was not clear enough, of course OOM is very bad behavior and should be corrected,
even if this would result in changes for some users (hopefully not).
My point in the previous message was only against silent mode.

Thanks!

On Thu, Apr 30, 2026 at 3:03 PM Andrey Borodin <x4mmm@yandex-team.ru> wrote:


> On 29 Apr 2026, at 01:19, Nikita Malakhov <hukutoc@gmail.com> wrote:
>
> According to the Jsonpath standard, malformed expression should return an error,
> but not all cases of malformation are thoroughly described.
>
> When this functionality was developed (Jsonpath and SQL/JSON) the absence
> of the variable was considered as malformation and was decided to throw an error
> in threads long time ago. In case this behavior to be a subject for change it surely
> should not be backported, but the error-throwing code has to.

I think you just explained very well why we throw an error. Your arguments against
silent mode are valid and we don't need to consider RETURN_ERROR any further.

Current master behavior throws an error, in this thread author propose to backport it.
This might be behavior change for some users. But it seems to me we have to backport,
because

SELECT '42'::jsonb @? '$"no_such_var"';

should not return true. What do you think?


Best regards, Andrey Borodin.


--
Regards,
Nikita Malakhov
Postgres Professional
The Russian Postgres Company

pgsql-bugs by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: BUG #19490: Streaming standby on 16.14 stops applying WAL on MultiXactOffsetSLRU when primary is 16.8
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG #19490: Streaming standby on 16.14 stops applying WAL on MultiXactOffsetSLRU when primary is 16.8