Skip to content

Instantly share code, notes, and snippets.

@cfirmo33
Last active November 24, 2017 18:22
Show Gist options
  • Save cfirmo33/d55fda6c73b6544a0f4b1ffdd1f7d84d to your computer and use it in GitHub Desktop.
Save cfirmo33/d55fda6c73b6544a0f4b1ffdd1f7d84d to your computer and use it in GitHub Desktop.
Lista das colunas de uma tabela
select
c.relname as tableName,
a.attname as "Column",
pg_catalog.format_type(a.atttypid, a.atttypmod) as "Datatype"
from pg_catalog.pg_attribute a
inner join pg_stat_user_tables c on a.attrelid = c.relid
WHERE
a.attnum > 0
AND NOT a.attisdropped
AND c.relname like '@TABLE_NAME'
AND a.attname like '%COLUNM_DESC%'
order by c.relname, a.attname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment