ALTER TABLE
ALTER TABLE
ALTER TABLE
ERROR: could not create unique index "posts_search_pkey"
DETAIL: Key (post_id)=(36946) is duplicated.
EXCEPTION: psql failed: DETAIL: Key (post_id)=(36946) is duplicated.
/var/www/discourse/lib/backup_restore/database_restorer.rb:92:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'
script/discourse:149:in `restore'
./launcher enter app
su - postges
psql discourse
select id from post_search_data where post_id>86918 and post_id<86921;
--- 获取 ID 时 ----
delete from post_search_data where id=ID_FROM_LAST_QUERY
discourse=# reindex index concurrently "posts_search_pkey";
ERROR: could not create unique index "posts_search_pkey_ccnew2"
DETAIL: Key (post_id)=(116038) is duplicated.
discourse=# delete from post_search_data
where post_id = 116038;
DELETE 2
discourse=# delete from post_search_data
where post_id = 116038;
DELETE 0
discourse=# reindex index concurrently "posts_search_pkey";
ERROR: could not create unique index "posts_search_pkey_ccnew3"
DETAIL: Key (post_id)=(9336) is duplicated.
discourse=# delete from post_search_data
where post_id = 9336;
DELETE 1
.
.
.
.
discourse=# reindex index concurrently "posts_search_pkey";
REINDEX