Re: Incorrect matching of sql/json PASSING variable names - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Incorrect matching of sql/json PASSING variable names
Date
Msg-id CA+HiwqH4-cWBhn-6OaBk2QmzV+8MocW6EBYydMLfaF+R1J24kQ@mail.gmail.com
Whole thread Raw
In response to Re: Incorrect matching of sql/json PASSING variable names  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-hackers
On Thu, Jun 13, 2024 at 5:04 PM Amit Langote <amitlangote09@gmail.com> wrote:
> On Thu, Jun 6, 2024 at 6:20 PM Amit Langote <amitlangote09@gmail.com> wrote:
> >
> > Hi,
> >
> > Alvaro reported off-list that the following should really fail,
> > because the jsonpath expression refers to a PASSING variable that
> > doesn't exist:
> >
> > select json_query('"1"', jsonpath '$xy' passing 2 AS xyz);
> >  json_query
> > ------------
> >  2
> > (1 row)
> >
> > This works because of a bug in GetJsonPathVar() whereby it allows a
> > jsonpath expression to reference any prefix of the PASSING variable
> > names.
> >
> > Attached is a patch to fix that.
>
> Here's an updated version that I'll push tomorrow.

Pushed.

(Seems like pgsql-committers notification has stalled.)

--
Thanks, Amit Langote



pgsql-hackers by date:

Previous
From: "Li, Yong"
Date:
Subject: Re: Separate HEAP WAL replay logic into its own file
Next
From: Amit Langote
Date:
Subject: Re: ON ERROR in json_query and the like