Re: JSON doc example (matchiness) - Mailing list pgsql-hackers

From Erik Rijkers
Subject Re: JSON doc example (matchiness)
Date
Msg-id e787e5db-b302-01d6-417f-59c541039a00@xs4all.nl
Whole thread Raw
In response to Re: JSON doc example (matchiness)  (Michael Paquier <michael@paquier.xyz>)
Responses Re: JSON doc example (matchiness)
List pgsql-hackers
On 5/8/21 3:48 AM, Michael Paquier wrote:
> On Fri, May 07, 2021 at 10:18:44PM +0200, Erik Rijkers wrote:
>> The JSON doc has this example (to show the need for double backslash):
>>
>> $ ? (@ like_regex "^\\d+$")
>>
>>
>> The example is not wrong exactly, and can be cast to jsonpath, but as-is can
>> never match anything.
>>
>> I think it'd be helpful to provide that example so that it more probably
>> matches when the user does a quick trial.
>>
>> Llet's change it to something like:
>>
>> $.* ? (@ like_regex "^\\d+$")
> Ah, I see.  What you are telling here is that we match the regex on
> the full JSON string, which is pretty useless, and you are suggesting
> to change things so as we'd match with the key names at the first
> level.  Makes sense.
>
> This paragraph of the docs say:
> "For example, to match strings that contain only digits"
> Could we be more precise here?  "strings" looks to much generic to
> me in this context when actually referring to a set of path of keys in
> a JSON blob.

Yes, "string values"  is probably another small improvement.


> --
> Michael



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: plan with result cache is very slow when work_mem is not enough
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] force_parallel_mode and GUC categories