Last active
May 22, 2024 13:26
-
-
Save alexanderlz/7302623 to your computer and use it in GitHub Desktop.
Get column description in postgresql/redshift
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 description FROM pg_catalog.pg_description WHERE objsubid = | |
( | |
SELECT ordinal_position FROM information_schema.columns WHERE table_name='YOUR_TABLE_NAME' AND column_name='YOUR_COLUMN_NAME' | |
) | |
and objoid = | |
( | |
SELECT oid FROM pg_class WHERE relname = 'YOUR_TABLE_NAME' AND relnamespace = | |
( | |
SELECT oid FROM pg_catalog.pg_namespace WHERE nspname = 'public' | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This thread helped me a lot too. Studying a little the query from @johnson-jay-l , I was able to add the table owner as well: