I’m trying to restore a database created on "Discourse 2.9.0.beta10 - https://github.com/discourse/discourse version 8d3fe3ddc5d38ab02a8f5c6aed7ebf7a6bcfbfec">
and restore to Discourse 2.9.0.beta12 - https://github.com/discourse/discourse version d4371a9ffcc6c727105a880b4b70c715ed0283cb">. Both are using RDS Postgres 13.7. The uncompressed database is 126GB, so after spending a couple of days believing that I need a 200GB disk to run this restore of the 30GB compressed database, I get this:
ERROR: function "entity2char" already exists with same argument types
EXCEPTION: psql failed: ERROR: function "entity2char" already exists with same argument types
Searching "entity2char" already exists finds nothing and I don’t see entity2char in core or any of the plugins. And I don’t see it in retort either, which I was hoping to blame, but removing it didn’t help.
I was seconds away from deleting it from the database, as it seems much easier to do whatever SQL has for
drop function entity2char;
I was able to list them it \df
You think if I remove it from the database it’ll break something?
Wait. . . . And the point of this exercise of restoring the production database to the new image I’d like to launch is to make sure that discourse will work with the existing production database when I install the latest Discourse and migrate the database, so modifying the database in order to restore it on staging doesn’t make sense.
Oh! So the issue is that the staging database has that function already, and the backup also has that function and it’s too stupid to understand that it’s the same function.
Maybe I should just drop and create the database on the staging/target site?
But your idea seems a bit easier.
EDIT: OK, I renamed the function and am doing the restore now. In about an hour I can see if it worked.
And the concern is that somehow the entity2char function that gets carried along in the backup will somehow not work with the existing database? Maybe I should just create a fresh new database and restore to it. I’m not a real fan of the name xx-discourse-database-5 anyway.
EDIT: Well, it looks like there are some more moles I will need to whack.
ERROR: function "replace_mentions" already exists with same argument types
Maybe starting with a new database is the way to go.