Created
July 10, 2019 06:00
-
-
Save guoweihua1982/289bc62565a186407ae0ae15e9431824 to your computer and use it in GitHub Desktop.
Useful PostgreSQL SQL
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
-- show all tables and columns and type definitions | |
SELECT s.schemaname,s.relname,a.attname,format_type(a.atttypid, a.atttypmod) | |
FROM pg_attribute a | |
INNER JOIN pg_stat_user_tables s ON s.relid = a.attrelid | |
WHERE a.attnum > 0 | |
ORDER BY 1,2,3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment