From 2b3fc59206fec1923abf43806541dbab2ba5c1d8 Mon Sep 17 00:00:00 2001 From: glyn Date: Mon, 19 Jan 2015 09:19:58 +0000 Subject: [PATCH] Use to_json rather than blindly quoting strings in where clause --- pg_jsonb_delete_op.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pg_jsonb_delete_op.sql b/pg_jsonb_delete_op.sql index 5d6473b..86868ff 100755 --- a/pg_jsonb_delete_op.sql +++ b/pg_jsonb_delete_op.sql @@ -12,7 +12,7 @@ $BODY$ ( SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}') FROM jsonb_each(a) - WHERE NOT ('{"' || key || '":' || value || '}')::jsonb ? b + WHERE NOT ('{' || to_json(key) || ':' || value || '}')::jsonb ? b ) , '{}')::jsonb; $BODY$ @@ -31,7 +31,7 @@ $BODY$ ( SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}') FROM jsonb_each(a) - WHERE NOT ('{"' || key || '":' || value || '}')::jsonb ?| b + WHERE NOT ('{' || to_json(key) || ':' || value || '}')::jsonb ?| b ) , '{}')::jsonb; $BODY$ @@ -50,7 +50,7 @@ $BODY$ ( SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}') FROM jsonb_each(a) - WHERE NOT ('{"' || key || '":' || value || '}')::jsonb <@ b + WHERE NOT ('{' || to_json(key) || ':' || value || '}')::jsonb <@ b ) , '{}')::jsonb; $BODY$ -- 2.39.5