Re: Variable substitution in jsonb functions fails for jsonpath operator like_regex

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jeff Janes <jeff.janes@gmail.com>, Erwin Brandstetter <brsaweda@gmail.com>, PostgreSQL Bug List <pgsql-bugs@lists.postgresql.org>
Date: 2023-10-19T02:13:16Z
Lists: pgsql-bugs
On Wed, Oct 18, 2023, 18:47 Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Jeff Janes <jeff.janes@gmail.com> writes:
> > On Wed, Oct 18, 2023 at 5:20 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> Maybe it wouldn't take more than s/STRING_P/starts_with_initial/
> >> here (though I'd then rename starts_with_initial to something
> >> more generic).
>
> > I tried it, and it didn't work.  No error, it just doesn't match
> > anything--including literal values which do match things in HEAD.


> 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.

David J.

>