It is possible for data within a PostgreSQL database table to get out of sync. When this happens it is possible for an attempt to be made to write data to a row in a table that already exists. This is being kept track of internally within Postgres by an ID of some sort and you can reset what the next ID that will be written to a row will be. Typically this will resolve your issue.
I received the below error in a Ruby on Rails application that was attempting to write data to PostgreSQL and at some point the data got out of wack.