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

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Nikita Malakhov <hukutoc(at)gmail(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Andrey Rachitskiy <pl0h0yp1(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, dhyan(at)nataraj(dot)su
Subject: Re: BUG #19458: OOM killer in jsonb_path_exists_opr (@?) with malformed JSONPath containing non-existent variables
Date: 2026-04-30 12:03:29
Message-ID: 6DE4A9D6-6D5C-41C0-8AFE-F51CFBDDAD5A@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On 29 Apr 2026, at 01:19, Nikita Malakhov <hukutoc(at)gmail(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Frank Heikens 2026-04-30 14:03:14 Re: Interval unit format bug
Previous Message Andrey Borodin 2026-04-30 07:56:17 Re: Potential buffer overrun in spell.c's CheckAffix()