# Restore failed \`entity2char already exists' RDS Postgres 13.7

**URL:** https://meta.discourse.org/t/restore-failed-entity2char-already-exists-rds-postgres-13-7/245964
**Category:** Self-hosting
**Created:** [November 17, 2022, 8:43pm UTC](https://meta.discourse.org/t/restore-failed-entity2char-already-exists-rds-postgres-13-7/245964 "2022-11-17T20:43:16Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [November 18, 2022, 12:54pm UTC](https://meta.discourse.org/t/restore-failed-entity2char-already-exists-rds-postgres-13-7/245964/7 "2022-11-18T12:54:22Z")

</div>

> [@pfaffman](#):
>
> You think if I remove it from the database it’ll break something?

Yes exactly this

> [@pfaffman](#):
>
> so modifying the database in order to restore it on staging doesn’t make sense.

and this 😉

What MIGHT work is that you try to rename the function in the target database instance just prior to restoring. But I have not tested that.

So (on the target db)

- `ALTER FUNCTION entity2char RENAME TO e2c_outoftheway`
- restore
- `ALTER FUNCTION entity2char RENAME TO e2c_from_backup`
- `ALTER FUNCTION e2c_outoftheway RENAME TO entity2char `

---

_[View the full topic](https://meta.discourse.org/t/restore-failed-entity2char-already-exists-rds-postgres-13-7/245964)._
