# Échec de la restauration : la fonction "post\_replies\_sync\_reply\_id" existe déjà avec les mêmes types d'arguments

**URL:** <https://meta.discourse.org/t/restore-fails-with-function-post-replies-sync-reply-id-already-exists-with-same-argument-types/156761>\
**Category:** Product Support\
**Created:** [Juillet 4, 2020, 7:14 UTC](https://meta.discourse.org/t/restore-fails-with-function-post-replies-sync-reply-id-already-exists-with-same-argument-types/156761 "2020-07-04T07:14:48Z")\
**Posts on this page:** 1\
**Showing post:** 1

<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:** [Juillet 4, 2020, 7:14 UTC](https://meta.discourse.org/t/restore-fails-with-function-post-replies-sync-reply-id-already-exists-with-same-argument-types/156761/1 "2020-07-04T07:14:48Z")

</div>

Ce n’a pas été une bonne journée. Il s’agit d’un site avec lequel j’avais déjà rencontré des problèmes dus à une tentative ratée de réplication de la base de données vers un autre serveur. Ces problèmes ont ensuite entraîné le remplissage du disque et la rupture complète de PostgreSQL. Je tente maintenant de restaurer vers un serveur de base de données différent. La sauvegarde a été effectuée sur une instance Discourse récente sur un serveur PG10 et la restauration est destinée à un serveur PG12.

Lorsque j’essaie de restaurer, cela échoue avec :

```plaintext
ERROR: function "post_replies_sync_reply_id" already exists with same argument types
EXCEPTION: psql failed: ERROR: function "post_replies_sync_reply_id" already exists with same argument types
/var/www/discourse/lib/backup_restore/database_restorer.rb:95:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:49:in `run'
script/discourse:143:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
script/discourse:284:in `<top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2020-07-04-061246' directory...
Unpausing sidekiq...
Disabling readonly mode...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

```

Je vois quelques migrations datant de janvier qui contiennent `post_replies_sync_reply_id`, il est donc possible que cela ne soit pas lié à mes propres problèmes de base de données mal gérés.

EDIT : J’ai résolu le problème pour cette base de données en supprimant la base de données et en exécutant `psql < backup-file.sql`, mais j’en ai encore quelques autres à restaurer.

---

_[View the full topic](https://meta.discourse.org/t/restore-fails-with-function-post-replies-sync-reply-id-already-exists-with-same-argument-types/156761)._
