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

From Amit Langote
Subject Incorrect matching of sql/json PASSING variable names
Date
Msg-id CA+HiwqFGkLWMvELBH6E4SQ45qUHthgcRH6gCJL20OsYDRtFx_w@mail.gmail.com
Whole thread Raw
Responses Re: Incorrect matching of sql/json PASSING variable names
List pgsql-hackers
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.

Thanks Alvaro for the report.

-- 
Thanks, Amit Langote

Attachment

pgsql-hackers by date:

Previous
From: Jelte Fennema-Nio
Date:
Subject: Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs
Next
From: Andrei Lepikhov
Date:
Subject: Re: Proposal: Job Scheduler