Re: Bug in jsonb_path_exists (maybe _match) one-element scalar/variable jsonpath handling

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Bug List <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Bug in jsonb_path_exists (maybe _match) one-element scalar/variable jsonpath handling
Date: 2022-12-05 23:57:49
Message-ID: CAPpHfdtweZwYrf0uTXRWiFRW6_L0eAWMBQFH9fM-SCbwqikJUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Dec 2, 2022 at 3:18 PM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
> Draft patch fixing the issue is attached. Let me know what you think
> about this.

Revised patch is attached, wrong pfree() is fixed. I was intended to
backpatch it. But the behavior change makes me uneasy.

select * from jsonb_path_query('{"a": 10}', '$ ? (@.a < $value)');

Currently, this query generates an error because of missing "value"
variable. The patch suppress this error. I'm not sure this error
should be suppressed. Especially, I'm sure this should be
backpatched.

Should we fix only existence checking behaviour and let other cases
throw an error? Thoughts?

------
Regards,
Alexander Korotkov

Attachment Content-Type Size
0001-Teach-jsonpath-to-handle-missing-variables-v2.patch application/octet-stream 4.9 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-12-06 15:23:57 Re: PG 14.5 -- Impossible to restore dump due to interaction/order of views, functions, and generated columns
Previous Message Nunya Business 2022-12-05 19:49:40 PG 14.5 -- Impossible to restore dump due to interaction/order of views, functions, and generated columns