1 -- The functions in this script are SQL versions of the C ones for comparison
2 -- of performance between the two.
4 CREATE OR REPLACE FUNCTION jsonb_delete_left(a jsonb, b text)
9 SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}')
15 LANGUAGE sql IMMUTABLE STRICT;
19 CREATE OR REPLACE FUNCTION jsonb_delete_left(a jsonb, b text[])
24 SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}')
30 LANGUAGE sql IMMUTABLE STRICT;
34 CREATE OR REPLACE FUNCTION jsonb_delete_left(a jsonb, b jsonb)
39 SELECT ('{' || string_agg(to_json(key) || ':' || value, ',') || '}')
41 WHERE NOT ('{' || to_json(key) || ':' || value || '}')::jsonb <@ b
45 LANGUAGE sql IMMUTABLE STRICT;
49 CREATE OR REPLACE FUNCTION jsonb_concat_left (a jsonb, b jsonb)
52 SELECT json_object_agg(key, value)::jsonb FROM
54 SELECT * FROM jsonb_each(a)
56 SELECT * FROM jsonb_each(b)
59 LANGUAGE sql IMMUTABLE STRICT;