Last active
August 15, 2018 04:25
-
-
Save cchng/8d1f12dd7b9e96a13a266e0e32734cff to your computer and use it in GitHub Desktop.
a query for useful information on your data in a specified schema
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
| -- https://stackoverflow.com/questions/343138/retrieving-comments-from-a-postgresql-db | |
| SELECT col.table_name,col.column_name, pgd.description, col.data_type | |
| FROM pg_catalog.pg_statio_all_tables AS st | |
| INNER JOIN pg_catalog.pg_description pgd ON (pgd.objoid=st.relid) | |
| INNER JOIN information_schema.columns col ON (pgd.objsubid=col.ordinal_position | |
| AND col.table_schema=st.schemaname AND col.table_name=st.relname) | |
| WHERE col.table_schema = $schema_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment