Restore failed after reinstall


(Abel Van) #1

I run in the newest version 1.0.0 (for both old and new, but maybe they are use different ruby version, now I am on 2.0.0-p195, since the newest version 2.1.2 can’t work for discourse), It seems work perfect after the (totally) reinstall, except that I can’t restore the backups which are, of course, backed up by the older program. And the error reads:

<supress some code>    
[Invalid date] CREATE INDEX
[Invalid date] CREATE INDEX
[Invalid date] CREATE INDEX
[Invalid date] Enabling readonly mode...
[Invalid date] Pausing sidekiq...
[Invalid date] Waiting for sidekiq to finish running jobs...
[Invalid date] Switching schemas...
[Invalid date] EXCEPTION: PG::Error: ERROR:  syntax error at or near "NOT"
LINE 7:         CREATE SCHEMA IF NOT EXISTS backup;
                                 ^
: BEGIN;
      DO $$DECLARE row record;
      BEGIN
        -- create <destination> schema if it does not exists already
        -- NOTE: DROP & CREATE SCHEMA is easier, but we don't want to drop the public schema
        -- ortherwise extensions (like hstore & pg_trgm) won't work anymore...
        CREATE SCHEMA IF NOT EXISTS backup;
        -- move all <source> tables to <destination> schema
        FOR row IN SELECT tablename FROM pg_tables WHERE schemaname = 'public'
        LOOP
<supress some code>

I tested that, I can backup and restore by the program running now.

Please help me out here!


(Jens Maier) #2

The backup was created with PostgreSQL 9.3’s pg_dump, but you are trying to restore it in a Discourse that is running on PostgreSQL 9.2 or older. If you’ve followed the recommended Docker installation guide, reinstall Discourse and use the postgres.template.yml instead of postgres.9.2.template.yml. If you’re trying to install Discourse in an unsupported way, update your system’s PostgreSQL to 9.3.


(Abel Van) #3

That’s it, this absolutly solves my problem.


(Régis Hanol) #4