Re: jsonpath: Missing regex_like && starts with Errors? - Mailing list pgsql-hackers

From Chapman Flack
Subject Re: jsonpath: Missing regex_like && starts with Errors?
Date
Msg-id 6670BC59.1010204@acm.org
Whole thread Raw
In response to Re: jsonpath: Missing regex_like && starts with Errors?  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: jsonpath: Missing regex_like && starts with Errors?
List pgsql-hackers
On 06/17/24 18:14, David E. Wheeler wrote:
> So I think that’s the key: There’s not a difference between the behavior of
> `like_regex` and `starts with` vs other predicate expressions.

The current implementation seems to have made each of our
<JSON path predicate>s responsible for swallowing its own errors, which
is one perfectly cromulent way to satisfy the SQL standard behavior saying
all errors within a <JSON filter expression> should be swallowed.

The standard says nothing on how they should behave outside of a
<JSON filter expression>, because as far as the standard's concerned,
they can't appear there.

Ours currently behave the same way, and swallow their errors.

It would have been possible to write them in such a way as to raise errors,
but not when inside a <JSON filter expression>, and that would also satisfy
the standard, but it would also give us the errors you would like from our
nonstandard "predicate check expressions". And then you could easily use
silent => true if you wanted them silent.

I'd be leery of changing that, though, as we've already documented that
a "predicate check expression" returns true, false, or unknown, so having
it throw by default seems like a change of documented behavior.

The current situation can't make much use of 'silent', since it's already
false by default; you can't make it any falser to make predicate-check
errors show up.

Would it be a thinkable thought to change the 'silent' default to null?
That could have the same effect as false for SQL standard expressions, and
the same effect seen now for "predicate check expressions", and you could
pass it explicitly false if you wanted errors from the predicate checks.

If that's no good, I don't see an obvious solution other than adding
another nonstandard construct to what's nonstandard already, and allowing
something like nonsilent(predicate check expression).

Regards,
-Chap



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: cost delay brainstorming
Next
From: "David E. Wheeler"
Date:
Subject: Re: jsonpath: Missing regex_like && starts with Errors?