pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>
Cc: Erwin Brandstetter <brsaweda@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: Thu, 19 Oct 2023 15:01:19 -0400
Message-ID: <3378578.1697742079@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwaBB+PPZkn0GtTzt5z6Vtypt2CQ-5+nK7XzW6zm9UqaDQ@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>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Wed, Oct 18, 2023, 18:47 Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Oh, duh, makeItemLikeRegex() is expecting a plain JsonPathString,
>> and JsonPathParseItem.value.like_regex is set up for just a
>> constant pattern.  We could no doubt fix that, but it's a bigger
>> lift than I was hoping.

> Not in a position to do it myself but we should confirm we aren't simply
> following the standard here, and if so decide whether we want to deviate.

Hmm ... looks like we *are* following the standard:


<JSON like_regex predicate> ::=
  <JSON path wff> like_regex <JSON like_regex pattern>
      [ flag <JSON like_regex flags> ]
<JSON like_regex pattern> ::=
  <JSON path string literal>
<JSON like_regex flag> ::=
  <JSON path string literal>

whereas "starts with" has

<JSON starts with predicate> ::=
  <JSON starts with whole> starts with <JSON starts with initial>
<JSON starts with whole> ::=
  <JSON path wff>
<JSON starts with initial> ::=
  <JSON path wff>

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.


			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <3378578.1697742079@sss.pgh.pa.us>
Permalink:  ../3378578.1697742079@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3378578.1697742079@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, david.g.johnston@gmail.com, jeff.janes@gmail.com, brsaweda@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Variable substitution in jsonb functions fails for jsonpath operator like_regex
  In-Reply-To: <3378578.1697742079@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