Created
June 26, 2018 03:36
-
-
Save Sillson/13fd024b753f3bfead26086e2dcc6783 to your computer and use it in GitHub Desktop.
jsonb_to_pg_array
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_array_to_text_array( | |
p_input jsonb | |
) RETURNS TEXT[] AS $BODY$ | |
DECLARE v_output text[]; | |
BEGIN | |
SELECT array_agg(ary)::text[] | |
INTO v_output | |
FROM jsonb_array_elements_text(p_input) AS ary; | |
RETURN v_output; | |
END; | |
$BODY$ | |
LANGUAGE plpgsql VOLATILE; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment