X-Git-Url: https://git.8kb.co.uk/?p=postgresql%2Fpg_jsonb_opx;a=blobdiff_plain;f=sql%2Fjsonb_opx_sql_comparison.sql;fp=sql%2Fjsonb_opx_sql_comparison.sql;h=0000000000000000000000000000000000000000;hp=4bfebf610de4d66bbbecee023bec314e9b1f19a7;hb=b2272ef16fe0e6aa9b769f4517e9fe7177e3f444;hpb=bf6318c60bd05043800c698a6b14f6aaa17a4824 diff --git a/sql/jsonb_opx_sql_comparison.sql b/sql/jsonb_opx_sql_comparison.sql deleted file mode 100755 index 4bfebf6..0000000 --- a/sql/jsonb_opx_sql_comparison.sql +++ /dev/null @@ -1,59 +0,0 @@ --- The functions in this script are SQL versions of the C ones for comparison --- of performance between the two. - -CREATE OR REPLACE FUNCTION jsonb_delete_left(a jsonb, b text) -RETURNS jsonb AS -$BODY$ -SELECT COALESCE( -( -SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}') -FROM jsonb_each(a) -WHERE key <> b -) -, '{}')::jsonb; -$BODY$ -LANGUAGE sql IMMUTABLE STRICT; - --- - -CREATE OR REPLACE FUNCTION jsonb_delete_left(a jsonb, b text[]) -RETURNS jsonb AS -$BODY$ -SELECT COALESCE( -( -SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}') -FROM jsonb_each(a) -WHERE key <> ALL(b) -) -, '{}')::jsonb; -$BODY$ -LANGUAGE sql IMMUTABLE STRICT; - --- - -CREATE OR REPLACE FUNCTION jsonb_delete_left(a jsonb, b jsonb) -RETURNS jsonb AS -$BODY$ -SELECT COALESCE( -( -SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}') -FROM jsonb_each(a) -WHERE NOT ('{' || to_json(key) || ':' || value || '}')::jsonb <@ b -) -, '{}')::jsonb; -$BODY$ -LANGUAGE sql IMMUTABLE STRICT; - --- - -CREATE OR REPLACE FUNCTION jsonb_concat_left (a jsonb, b jsonb) -RETURNS jsonb AS -$BODY$ -SELECT json_object_agg(key, value)::jsonb FROM -( - SELECT * FROM jsonb_each(a) - UNION ALL - SELECT * FROM jsonb_each(b) -) a; -$BODY$ -LANGUAGE sql IMMUTABLE STRICT;