Last active
September 15, 2018 07:04
-
-
Save ichux/8119b539a836c682e3c7f0ebc5df655e to your computer and use it in GitHub Desktop.
List all the tables in Postgres public schema
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 public.list_public_tables() | |
RETURNS TABLE(name character varying) | |
LANGUAGE plpgsql | |
AS $function$ | |
BEGIN | |
FOR name IN SELECT quote_ident(table_name) FROM information_schema.tables WHERE table_schema = 'public' LOOP | |
RETURN NEXT; | |
END LOOP; | |
END; | |
$function$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment