[pgsql-jp: 32740] Re: テーブル属性を知る SQL ってありますか?
Kuniteru Asami
asami @ aqua-systems.co.jp
2004年 4月 9日 (金) 12:42:47 JST
こんにちは、浅見です。
それぞれ、下の条件もあたえることで、余分なものを省けます。
> select relname , relfilenode from pg_class
> 登録されているテーブルの名前が取れました。
> しかし、なんか余分なものまで‥
relkind = 'r'
> select attname , atttypid from pg_attribute where attrelid = 上記のrelfilenode
> テーブルの項目名がわかります
> これまた、余分なものまで‥
attnum > 0
それから、これは
> select typname , typelem from pg_type where typelem = 上記のatttypid
> _が付いて項目属性がわかります。
> _bpchar _numeric など
select typname , typelem from pg_type where oid = 上記のatttypid
が正解ですね。 ^^^^^
> こんな事して大丈夫ですか?
> 読み込むだけだから大丈夫ですよね (^_^;)
大丈夫ですよ。
0---------0---------0---------0---------0---------0---------0
00 浅見 城輝 (Kuniteru Asami)
0-0 mailto:asami @ aqua-systems.co.jp
0--0 http://www.fiberbit.net/user/kunyami/postgresql/
pgsql-jp メーリングリストの案内