Created
May 23, 2013 20:10
-
-
Save benlemasurier/5639040 to your computer and use it in GitHub Desktop.
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
| SELECT | |
| a.attname AS field, | |
| t.typname AS type, | |
| format_type(a.atttypid, a.atttypmod) AS complete_type, | |
| a.attnotnull AS isnotnull, | |
| (SELECT 't' | |
| FROM pg_index | |
| WHERE c.oid = pg_index.indrelid | |
| AND a.attnum = ANY (pg_index.indkey) | |
| AND pg_index.indisprimary = 't' | |
| ) AS pri, | |
| (SELECT pg_attrdef.adsrc | |
| FROM pg_attrdef | |
| WHERE c.oid = pg_attrdef.adrelid | |
| AND pg_attrdef.adnum=a.attnum | |
| ) AS default | |
| FROM pg_attribute a, pg_class c, pg_type t | |
| WHERE c.relname = 'admin_modifications' | |
| AND a.attnum > 0 | |
| AND a.attrelid = c.oid | |
| AND a.atttypid = t.oid | |
| ORDER BY a.attnum; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment