Re: Re: SQL/JSON: functions - Mailing list pgsql-hackers

From Andrew Alsup
Subject Re: Re: SQL/JSON: functions
Date
Msg-id d8f9305c-645a-e303-f7ee-02179d9cba6e@gmail.com
Whole thread Raw
In response to Re: SQL/JSON: functions  (Nikita Glukhov <n.gluhov@postgrespro.ru>)
List pgsql-hackers
On 10/21/19 12:44 PM, Nikita Glukhov wrote:
>
> v39 patch is based on 5ee96b3e2221d154ffcb719bd2dee1179c53f821
>
> Use the following git command to apply patches:
>
> git am ~/Downloads/0001-Jsonpath-support-for-json-v39.patch
>

Thank you. The patch applied fine, with no errors.

Is this the type of testing that would be helpful? I plan to construct a 
number of separate queries to test more nuanced edge cases. This test 
simply compares the output of 4 separate sub-queries that should provide 
the same results.

SELECT
   CASE WHEN jop = jp_expr AND jop = jval AND jop = jval_path
     THEN 'pass'
     ELSE 'fail'
   END
FROM
   (
     -- jsonb operator
     SELECT count(*)
     FROM testjsonb
     WHERE j->>'abstract' LIKE 'A%'
   ) as jop,
   (
     -- jsonpath expression
     SELECT count(*)
     FROM testjsonb
     WHERE j @? '$.abstract ? (@ starts with "A")'
   ) as jp_expr,
   (
     -- json_value()
     SELECT count(*)
     FROM testjsonb
     WHERE JSON_VAlUE(j, 'lax $.abstract') LIKE 'A%'
   ) as jval,
   (
     -- json_value(jsonpath)
     SELECT count(*)
     FROM testjsonb
     WHERE JSON_VALUE(j, 'lax $.abstract ? (@ starts with "A")') IS NOT NULL
   ) as jval_path;


If I'm completely off base for how testing is normally conducted, please 
let me know.

Thanks,
Andrew Alsup



pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: logical replication empty transactions
Next
From: Amit Kapila
Date:
Subject: Re: dropdb --force