]> git.8kb.co.uk Git - postgresql/pg_jsonb_delete_op/commitdiff
Merge pull request #2 from schinckel/patch-2 master
authorGlyn Astill <glynastill@yahoo.co.uk>
Sat, 24 Jan 2015 08:10:56 +0000 (08:10 +0000)
committerGlyn Astill <glynastill@yahoo.co.uk>
Sat, 24 Jan 2015 08:10:56 +0000 (08:10 +0000)
Use array ALL() function, and remove json/jsonb casts

1  2 
pg_jsonb_delete_op.sql

diff --combined pg_jsonb_delete_op.sql
index 3a3c818352e5d11695d0cfb28ff50573bbd5ba3b,5671a35a2ced794e5ae4b74464a0ac8bb4850667..d7e345533ce10920620de24cb4221153a1b31238
@@@ -12,7 -12,7 +12,7 @@@ $BODY
          (
              SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}')
              FROM jsonb_each(a)
 -            WHERE NOT to_json(key)::jsonb ? b
 +            WHERE key <> b
          )
      , '{}')::jsonb;
  $BODY$
@@@ -31,7 -31,7 +31,7 @@@ $BODY
          (
              SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}')
              FROM jsonb_each(a)
-             WHERE NOT to_json(key)::jsonb ?| b
+             WHERE key <> ALL(b)
          )
      , '{}')::jsonb;
  $BODY$