# Cannot restore database: sql key is duplicated

**URL:** <https://meta.discourse.org/t/cannot-restore-database-sql-key-is-duplicated/237539>\
**Category:** Self-hosting\
**Created:** [August 30, 2022, 5:43am UTC](https://meta.discourse.org/t/cannot-restore-database-sql-key-is-duplicated/237539 "2022-08-30T05:43:05Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [August 30, 2022, 10:26am UTC](https://meta.discourse.org/t/cannot-restore-database-sql-key-is-duplicated/237539/3 "2022-08-30T10:26:27Z")

</div>

It looks like you have a corrupt index. You’ll need to delete or update those entries. If you search I think there may still be some topics that describe generally hour to do it.

On the old server you try to reindex that table and keep changing stuff until it succeeds. If you’re not familiar with sql and have a budget then you can ask in #Marketplace or contact me.

What version of Discourse and postgres are you running? I haven’t seen many cases of this since postgres 13.

---

_[View the full topic](https://meta.discourse.org/t/cannot-restore-database-sql-key-is-duplicated/237539)._
