Created
February 8, 2012 09:59
-
-
Save saihoooooooo/1767578 to your computer and use it in GitHub Desktop.
Select the table with a column that contains 'user_id'
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
SELECT DISTINCT | |
class.relname | |
FROM | |
pg_attribute AS att | |
INNER JOIN pg_class AS class | |
ON class.oid = att.attrelid | |
WHERE | |
att.attnum > 0 | |
AND att.attname = 'user_id' | |
AND class.relkind = 'r' | |
AND class.relname ! ~ * '.*ba?k.*' | |
ORDER BY | |
class.relname ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment