An error occurred while restoring from a backup: discourse_functions.raise_discourse_voting_category_settings_readonly() does not exist

Hello,

I have a back-up made using our main instance Discourse 3.4.0.beta1-dev version 633a19fcc09a41a31eadd176519483217b2ec241

I want to upload this back-up to a local instance, it’s a fresh install running Discourse 3.4.0.beta1-dev version 2b577950af5b24ed0d32eecc4ab6475619998fba

Here is the log, any suggestions for a workaround?

[2024-08-03 16:45:29] CREATE INDEX
[2024-08-03 16:45:29] CREATE INDEX
[2024-08-03 16:45:29] ERROR:  function discourse_functions.raise_discourse_voting_category_settings_readonly() does not exist
[2024-08-03 16:45:29] EXCEPTION: psql failed: ERROR:  function discourse_functions.raise_discourse_voting_category_settings_readonly() does not exist

Do you have the same set of plugins on your local instance?

1 Like

Hello,

I didn’t, the problem was the Post Voting Plugin was not installed. Interestingly, it was not enabled in the main site (just installed by default) but I guess that was enough to cause the error. Thanks.

2 Likes

I’m getting the same error on a development instance (where I just upgraded to pg16 to get the latest pgvector that was causing this retore to fail earlier) that I just git pulled.

I’ve added both post voting and topic voting (topic voting was on the source).

My inclination was to

 DROP table discourse_voting_category_settings;

But then I needed to add CASCADE and I chickened out and tried restoring to staging.

On a staging site, if I try to restore the same database, I get this:

ERROR:  type "hotlinked_media_status" already exists
EXCEPTION: psql failed: ERROR:  type "hotlinked_media_status" already exists
/var/www/discourse/lib/backup_restore/database_restorer.rb:92:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'

That seems different. I forgot about it in the last three weeks but since then we had a few cases of backups failing to restore when the post voting plugin was not installed. So that’s a thing for sure.

But hotlinked_media_status is a core table from 2022… so that must be something different.

./db/migrate/20220428094026_create_post_hotlinked_media.rb

(BTW I keep a diary of all issues from the past 11 years and I don’t have any mention of that one)

2 Likes

Well, I made sure that the dev instance has all of the plugins that the production site does and restored the backup there!

But the staging site, (that is missing the microsoft auth plugin for some reason, but that can’t be it, can it?!?!?!) still has the EXCEPTION: psql failed: ERROR: type "hotlinked_media_status" already exists problem.

But if only I would search:

Looks like something similar got fixed once. . .

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.