自分用メモ PostgreSQLでテーブル構造を取得したい場合に使用するSQL文 select n.nspname ,c.relkind ,c.relname ,a.attnum ,obj_description(c.relfilenode, 'pg_class' ::name) as tablecomment ,a.attname ,format_type(a.atttypid, a.atttypmod) AS dataname ,col_description(a.attrelid, a.attnum ::integer) as columncomment ,(select distinct case when a.attnum = any(i1.indkey) and i1.indisprimary = true then true else null end from pg_ind