Re: Shouldn't jsonpath .string() Unwrap?

Chapman Flack <jcflack@acm.org>

From: Chapman Flack <jcflack@acm.org>
To: "David E. Wheeler" <david@justatheory.com>, Andrew Dunstan <andrew@dunslane.net>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Date: 2024-06-14T01:55:04Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Teach jsonpath string() to unwrap in lax mode

On 06/13/24 18:45, David E. Wheeler wrote:
> On Jun 13, 2024, at 3:53 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
> 
>> Hmm. You might be right. Many of these items have this code, but the string() branch does not:
>> if (unwrap && JsonbType(jb) == jbvArray)
>>    return executeItemUnwrapTargetArray(cxt, jsp, jb, found,
>>                                        false);
> 
> Exactly, would be pretty easy to add. I can work up a patch this weekend.

My opinion is yes, that should be done. 9.46, umm, General
Rule 11 g ii 6) A) says just "if MODE is lax and <JSON method> is not
type or size, then let BASE be Unwrap(BASE)." No special exemption
there for string(), nor further below at C) XV) for the operation
of string().

Regards,
-Chap