Created
September 15, 2016 16:25
-
-
Save alastaircoote/9d2655dc37d4b30cc33f8d27642d80bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION jsonb_merge_state(jsonb, jsonb) | |
returns jsonb | |
language sql | |
as $$ | |
SELECT $1 || $2 | |
$$; | |
DROP AGGREGATE IF EXISTS jsonb_merge(jsonb); | |
CREATE AGGREGATE jsonb_merge(jsonb) ( | |
SFUNC = jsonb_merge_state, | |
STYPE = jsonb, | |
INITCOND = '{}' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment