[PostgreSQL] テーブル定義をSQL文で取得する
テーブルの定義(データ型、フィールド長、カラムの定義順、デフォルト値、NOT NULLなど)を一括して取得する SQL 文です。 テーブル名は、relname = 'table_name' の部分で指定します。 前の記事の方法より、こちらのほうが簡単で他の情報も取得できます。
select * from information_schema.columns where table_catalog = current_database() and table_name = 'table_name' order by ordinal_position ;
0 件のコメント