Skip to content

Instantly share code, notes, and snippets.

@letitride
Created March 2, 2013 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letitride/5070978 to your computer and use it in GitHub Desktop.
Save letitride/5070978 to your computer and use it in GitHub Desktop.
my tables infomation
SELECT
a.attname,
ty.typname,
a.atttypid,
a.atthasdef,
a.attnotnull,
a.attisdropped,
d.description
from
pg_stat_user_tables t
join pg_attribute a on
t.relid = a.attrelid
join pg_type ty on
a.atttypid = ty.oid
left join pg_description d on
a.attrelid = d.objoid and a.attnum = d.objsubid
where
a.attisdropped = false
and a.attnum > 0
order by a.attnum;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment