"EXCEPTION: psql failed: DETAIL: Key (post_id)=(36946) is duplicated."

It sounds like you have a corrupt index. What version of postgres is this?

There are a few topics about this. You can try to reindex that table on the running instance and then delete or fix the duplicate IDs.