* ALTER TABLE [#c87a7a78]

** NOT NULL制約をつける [#x54cf7ec]
 ALTER TABLE users ALTER tel SET not null;

** ユニーク制約をつける [#ob34c449]
 ALTER TABLE member ADD CONSTRAINT login_id_passwd_key UNIQUE (login_id, passwd)

** 主キーの削除 [#b1811695]
 ALTER TABLE users DROP CONSTRAINT users_pkey;

** 主キーの追加 [#o0b671a5]
 ALTER TABLE users ADD primary key ( user_id );

** 型変更 [#c6fcbacd]
 ALTER TABLE users ALTER birth_day TYPE timestamp
birth_dayを(date型などから)timestamp型に変える。

** テーブル名変更 [#l4428e5a]
 ALTER TABLE users RENAME TO users2;

** 所有者変更 [#g8c859a3]
 ALTER TABLE users OWNER to new_owner;
*** 参考 [#p04e2707]
http://stackoverflow.com/questions/1348126/modify-owner-on-all-tables-simultaneously-in-postgresql

** 参考 [#h40438a3]
http://www.postgresql.jp/document/current/html/sql-altertable.html

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS