Last active
July 30, 2019 12:23
-
-
Save Lkledu/478ed9daa5c8e2f082b378e9922418a5 to your computer and use it in GitHub Desktop.
Retorna uma coluna com suas foreign keys <POSTGRESQL>
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 | |
TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME | |
FROM | |
INFORMATION_SCHEMA.KEY_COLUMN_USAGE | |
WHERE | |
REFERENCED_TABLE_SCHEMA = '<database>' AND | |
REFERENCED_TABLE_NAME = '<table>' AND | |
REFERENCED_COLUMN_NAME = '<column>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment