戻る
■SQL
PostgreSQLにてテーブルやカラムの各種情報を取得するSQL - いろいろ備忘録日記 https://devlights.hatenablog.com/entry/20080226/p1 ■テーブル名の一覧を表示
SELECT psut.relname AS table_name ,pd.description AS table_comment FROM pg_stat_user_tables psut ,pg_description pd WHERE psut.relid=pd.objoid AND pd.objsubid=0 ORDER BY psut.relname
■テーブル列名の一覧を表示
SELECT pa.attname AS column_name, pd.description AS column_comment FROM pg_stat_all_tables psat ,pg_description pd ,pg_attribute pa WHERE psat.relname='users' AND psat.relid=pd.objoid AND pd.objsubid<>0 AND pd.objoid=pa.attrelid AND pd.objsubid=pa.attnum ORDER BY pd.objsubid