Created
February 23, 2016 16:23
-
-
Save smbarbour/dbfc57e2b1f4cb95b30f 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 meta_find_references(tablename text) | |
RETURNS TABLE (type text, name text) | |
AS $$ | |
SELECT 'View', table_name FROM information_schema.views WHERE view_definition ~* $1 | |
UNION | |
SELECT 'Function', routine_name FROM information_schema.routines WHERE routine_definition ~* $1 | |
ORDER BY 1, 2 | |
$$ | |
LANGUAGE SQL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment