pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Erwin Brandstetter <brsaweda@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: PostgreSQL Bug List <pgsql-bugs@lists.postgresql.org>
Subject: Re: Variable substitution in jsonb functions fails for jsonpath operator like_regex
Date: Mon, 23 Oct 2023 20:53:12 -0400
Message-ID: <460388.1698108792@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGHENJ7YdNYzZruGM2+fRDJZOn_7p6u3f686mzodbti_AQ8xbg@mail.gmail.com>
References: <CAGHENJ4A8awD2uXHkf50eV+9wyiDm3eP+G10J09+0VRmXBQAdw@mail.gmail.com>
	<3157573.1697663770@sss.pgh.pa.us>
	<CAMkU=1x1bkHBczE4XZ1w=pyE75EGbkxGMUOYLwHMkp4t74vUwg@mail.gmail.com>
	<3241895.1697679989@sss.pgh.pa.us>
	<CAKFQuwaBB+PPZkn0GtTzt5z6Vtypt2CQ-5+nK7XzW6zm9UqaDQ@mail.gmail.com>
	<3378578.1697742079@sss.pgh.pa.us>
	<CAGHENJ7YdNYzZruGM2+fRDJZOn_7p6u3f686mzodbti_AQ8xbg@mail.gmail.com>

Erwin Brandstetter <brsaweda@gmail.com> writes:
> On Thu, 19 Oct 2023 at 21:01, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Hmm ... looks like we *are* following the standard:
>>   ...
>> The text mentions that "the second operand is permitted to be an SQL/JSON
>> sequence and to support existential semantics", whereas they evidently
>> don't want that for a regex pattern.

> So input from "vars" cannot be substituted into the jsonpath expression
> after "like_regex" (as opposed to all other jsonpath operators). Seems
> pretty random from a user's perspective.

I agree it looks pretty random if you haven't drilled down into the
spec's fine print.  Personally I wouldn't be opposed to extending
the spec here (not that I'm volunteering to write the patch).

Nosing around in jsonpath_gram.y, I see datetime_template as the
only other place where there's a random-seeming choice to allow
STRING_P but not VARIABLE_P.  Should we tackle that too?

			regards, tom lane





view thread (8+ messages)

Message-ID: <460388.1698108792@sss.pgh.pa.us>
Permalink:  ../460388.1698108792@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/460388.1698108792@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, brsaweda@gmail.com, david.g.johnston@gmail.com, jeff.janes@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Variable substitution in jsonb functions fails for jsonpath operator like_regex
  In-Reply-To: <460388.1698108792@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox