Created
December 5, 2021 13:45
-
-
Save rinsuki/a02a556e1c1c319f95b4f5f602846cf2 to your computer and use it in GitHub Desktop.
This file contains 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 check_header_array(arr text[]) RETURNS BOOLEAN LANGUAGE plpgsql AS $$ | |
DECLARE | |
h text[]; | |
i text; | |
BEGIN | |
FOREACH h SLICE 1 IN ARRAY arr | |
LOOP | |
IF array_ndims(h) != 1 THEN RETURN false; END IF; | |
IF array_length(h, 1) != 2 THEN RETURN false; END IF; | |
FOREACH i IN ARRAY arr | |
LOOP | |
IF i IS NULL THEN RETURN false; END IF; | |
END LOOP; | |
END LOOP; | |
RETURN true; | |
END; | |
$$; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment