3,765
回編集
差分
→戒名テーブル 変更あり
ALTER TABLE</nowiki>
新テーブルのclient_id other_idに合わせるother_idは一意なので変更しない
<nowiki>update_heroku=# update kaimyous SET client_id = client_id + 20000 where note_id = 2;
UPDATE 587
update_heroku=# update kaimyous SET client_id = client_id + 40000 where note_id = 4;
UPDATE 256
エラー clientsテーブルのidとkaimyousテーブルのclient_idを比較する <nowiki>update_heroku=# update SELECT id FROM clientsEXCEPTSELECT client_id FROM kaimyous SET other_id = other_id + 20000 where note_id = 2UNION ALLSELECT client_id FROM kaimyous EXCEPTSELECT id FROM clients order by id;UPDATE 587 id ------- 21 27 35 38 39 44 46 56 57 63 71 73 78 89 101 106 111 126 127 135 144 147 156 173 174 176 186 188 189 230 310 373 404 473 701 804 872 936 953 972 998 1590 1671 1777 2249 2290 22653 34681(48 rows)</nowiki> 書き出す <nowiki>% psql update_heroku=# update -c "SELECT id FROM clientsEXCEPTSELECT client_id FROM kaimyousUNION ALLSELECT client_id FROM kaimyous SET other_id = other_id + 30000 where note_id = 3EXCEPTSELECT id FROM clients order by id;" > ../hikaku/clients_kaimyous_client_id.csv</nowiki> ,挿入 改行削除 :%s/\n//g UPDATE 662削除する戒名を書き出す <nowiki>% psql update_heroku=# update -c "select * from kaimyous SET other_id = other_id + 40000 where note_id = 4client_id in (21, 27, 35, 38, 39, 44, 46, 56, 57, 63, 71, 73, 78, 89, 101, 106, 111, 126, 127, 135, 144, 147, 156, 173, 174, 176, 186, 188, 189, 230, 310, 373, 404, 473, 701, 804, 872, 936, 953, 972, 998, 1590, 1671, 1777, 2249, 2290, 22653, 34681);UPDATE 256" > ../tmp/delete_kaimyou.csv</nowiki>
== UUIDを有効にする ==