Backup and restore SQL error


(Bohuslav Svancara) #1

I posted this problem an hour ago or so.
I can’t find it anywhere now.
So I am posting it again.

COMMIT;
E, [2014-10-28T15:49:02.059831 #30393] ERROR -- : PG::Error: ERROR:  syntax error at or near "NOT"
LINE 7:         CREATE SCHEMA IF NOT EXISTS backup;
                                 ^
[STARTED]
'Bob' has started the restore!
Marking restore as running...
Making sure /home/vagrant/vagrant/tmp/restores/default/2014-10-28-154900 exists...
Copying archive to tmp directory...
Unzipping archive...
Extracting metadata file...
Validating metadata...
  Current version: 20141020174120
  Restored version: 20141020174120
Extracting dump file...
Restoring dump file... (can be quite long)
SET
SET
SET
SET
SET
DROP SCHEMA
CREATE SCHEMA
SET
SET
SET
CREATE TABLE
CREATE SEQUENCE
ALTER SEQUENCE
CREATE TABLE
CREATE SEQUENCE
ALTER SEQUENCE
CREATE TABLE

------ snip to keep this poster under 32000 characters -----

CREATE SEQUENCE
ALTER SEQUENCE
CREATE TABLE
CREATE SEQUENCE
ALTER SEQUENCE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
ALTER TABLE
setval
--------
1
(1 row)
setval
--------
6
(1 row)
setval
--------
4
(1 row)
setval
--------
24
(1 row)
setval
--------
15
(1 row)
setval
--------
1
(1 row)
setval
--------
30
(1 row)
setval
--------
22896
(1 row)
setval
--------
2
(1 row)
setval
--------
1
(1 row)
setval
--------
1
(1 row)
setval
--------
1
(1 row)
setval
--------
80
(1 row)
setval
--------
41
(1 row)
setval
--------
61
(1 row)
setval
--------
32
(1 row)
setval
--------
1
(1 row)
setval
--------
1
(1 row)
setval
--------
1
(1 row)
setval
--------
1
(1 row)
setval
--------
61
(1 row)
setval
--------
40
(1 row)
setval
--------
1
(1 row)
setval
--------
16
(1 row)
setval
--------
3
(1 row)
setval
--------
1
(1 row)
setval
--------
1
(1 row)
setval
--------
12501
(1 row)
setval
--------
50
(1 row)
setval
--------
1
(1 row)
setval
--------
Enabling readonly mode...
Pausing sidekiq...
Waiting for sidekiq to finish running jobs...
Switching schemas...
D, [2014-10-28T15:49:02.055523 #30393] DEBUG -- :    (3.9ms)  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
          EXECUTE 'DROP TABLE IF EXISTS backup.' || quote_ident(row.tablename) || ' CASCADE;';
          EXECUTE 'ALTER TABLE public.' || quote_ident(row.tablename) || ' SET SCHEMA backup;';
        END LOOP;
        -- move all <source> views to <destination> schema
        FOR row IN SELECT viewname FROM pg_views WHERE schemaname = 'public'
        LOOP
          EXECUTE 'DROP VIEW IF EXISTS backup.' || quote_ident(row.viewname) || ' CASCADE;';
          EXECUTE 'ALTER VIEW public.' || quote_ident(row.viewname) || ' SET SCHEMA backup;';
        END LOOP;
      END$$;

      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 public;
        -- move all <source> tables to <destination> schema
        FOR row IN SELECT tablename FROM pg_tables WHERE schemaname = 'restore'
        LOOP
          EXECUTE 'DROP TABLE IF EXISTS public.' || quote_ident(row.tablename) || ' CASCADE;';
          EXECUTE 'ALTER TABLE restore.' || quote_ident(row.tablename) || ' SET SCHEMA public;';
        END LOOP;
        -- move all <source> views to <destination> schema
        FOR row IN SELECT viewname FROM pg_views WHERE schemaname = 'restore'
        LOOP
          EXECUTE 'DROP VIEW IF EXISTS public.' || quote_ident(row.viewname) || ' CASCADE;';
          EXECUTE 'ALTER VIEW restore.' || quote_ident(row.viewname) || ' SET SCHEMA public;';
        END LOOP;
      END$$;

COMMIT;
E, [2014-10-28T15:49:02.059831 #30393] ERROR -- : 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
          EXECUTE 'DROP TABLE IF EXISTS backup.' || quote_ident(row.tablename) || ' CASCADE;';
          EXECUTE 'ALTER TABLE public.' || quote_ident(row.tablename) || ' SET SCHEMA backup;';
        END LOOP;
        -- move all <source> views to <destination> schema
        FOR row IN SELECT viewname FROM pg_views WHERE schemaname = 'public'
        LOOP
          EXECUTE 'DROP VIEW IF EXISTS backup.' || quote_ident(row.viewname) || ' CASCADE;';
          EXECUTE 'ALTER VIEW public.' || quote_ident(row.viewname) || ' SET SCHEMA backup;';
        END LOOP;
      END$$;

      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 public;
        -- move all <source> tables to <destination> schema
        FOR row IN SELECT tablename FROM pg_tables WHERE schemaname = 'restore'
        LOOP
          EXECUTE 'DROP TABLE IF EXISTS public.' || quote_ident(row.tablename) || ' CASCADE;';
          EXECUTE 'ALTER TABLE restore.' || quote_ident(row.tablename) || ' SET SCHEMA public;';
        END LOOP;
        -- move all <source> views to <destination> schema
        FOR row IN SELECT viewname FROM pg_views WHERE schemaname = 'restore'
        LOOP
          EXECUTE 'DROP VIEW IF EXISTS public.' || quote_ident(row.viewname) || ' CASCADE;';
          EXECUTE 'ALTER VIEW restore.' || quote_ident(row.viewname) || ' SET SCHEMA public;';
        END LOOP;
      END$$;

COMMIT;
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
          EXECUTE 'DROP TABLE IF EXISTS backup.' || quote_ident(row.tablename) || ' CASCADE;';
          EXECUTE 'ALTER TABLE public.' || quote_ident(row.tablename) || ' SET SCHEMA backup;';
        END LOOP;
        -- move all <source> views to <destination> schema
        FOR row IN SELECT viewname FROM pg_views WHERE schemaname = 'public'
        LOOP
          EXECUTE 'DROP VIEW IF EXISTS backup.' || quote_ident(row.viewname) || ' CASCADE;';
          EXECUTE 'ALTER VIEW public.' || quote_ident(row.viewname) || ' SET SCHEMA backup;';
        END LOOP;
      END$$;

      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 public;
        -- move all <source> tables to <destination> schema
        FOR row IN SELECT tablename FROM pg_tables WHERE schemaname = 'restore'
        LOOP
          EXECUTE 'DROP TABLE IF EXISTS public.' || quote_ident(row.tablename) || ' CASCADE;';
          EXECUTE 'ALTER TABLE restore.' || quote_ident(row.tablename) || ' SET SCHEMA public;';
        END LOOP;
        -- move all <source> views to <destination> schema
        FOR row IN SELECT viewname FROM pg_views WHERE schemaname = 'restore'
        LOOP
          EXECUTE 'DROP VIEW IF EXISTS public.' || quote_ident(row.viewname) || ' CASCADE;';
          EXECUTE 'ALTER VIEW restore.' || quote_ident(row.viewname) || ' SET SCHEMA public;';
        END LOOP;
      END$$;

COMMIT;
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `exec'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
/home/vagrant/vagrant/lib/freedom_patches/active_record_base.rb:7:in `exec_sql'
/home/vagrant/vagrant/lib/backup_restore/restorer.rb:250:in `switch_schema!'
/home/vagrant/vagrant/lib/backup_restore/restorer.rb:46:in `run'
/home/vagrant/vagrant/lib/backup_restore/backup_restore.rb:161:in `block in start!'
/home/vagrant/vagrant/lib/backup_restore/backup_restore.rb:158:in `fork'
/home/vagrant/vagrant/lib/backup_restore/backup_restore.rb:158:in `start!'
/home/vagrant/vagrant/lib/backup_restore/backup_restore.rb:17:in `restore!'
/home/vagrant/vagrant/app/controllers/admin/backups_controller.rb:74:in `restore'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/abstract_controller/base.rb:189:in `process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal/rendering.rb:10:in `process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:113:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:113:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:149:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:149:in `block in halting_and_conditional'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:229:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:229:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:166:in `block in halting'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:86:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:86:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal/rescue.rb:29:in `process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/notifications.rb:159:in `block in instrument'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/notifications.rb:159:in `instrument'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/abstract_controller/base.rb:136:in `process'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionview-4.1.6/lib/action_view/rendering.rb:30:in `process'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal.rb:196:in `dispatch'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_controller/metal.rb:232:in `block in action'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:82:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:82:in `dispatch'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:50:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/routing/mapper.rb:45:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/journey/router.rb:73:in `block in call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/journey/router.rb:59:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/journey/router.rb:59:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:678:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/omniauth-1.2.2/lib/omniauth/builder.rb:59:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/conditionalget.rb:35:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/flash.rb:254:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/message_bus-1.0.5/lib/message_bus/rack/middleware.rb:55:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/cookies.rb:560:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/query_cache.rb:36:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activerecord-4.1.6/lib/active_record/migration.rb:380:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/activesupport-4.1.6/lib/active_support/callbacks.rb:82:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/reloader.rb:73:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/better_errors-2.0.0/lib/better_errors/middleware.rb:59:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/logster-0.1.6/lib/logster/middleware/reporter.rb:23:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/rack/logger.rb:38:in `call_app'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/rack/logger.rb:22:in `call'
/home/vagrant/vagrant/config/initializers/quiet_logger.rb:10:in `call_with_quiet_assets'
/home/vagrant/vagrant/config/initializers/silence_logger.rb:26:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/request_id.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/actionpack-4.1.6/lib/action_dispatch/middleware/static.rb:64:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
/home/vagrant/vagrant/lib/middleware/missing_avatars.rb:21:in `call'
/home/vagrant/vagrant/lib/middleware/turbo_dev.rb:32:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/engine.rb:514:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/application.rb:144:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/railtie.rb:194:in `public_send'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/railtie.rb:194:in `method_missing'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/builder.rb:138:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/urlmap.rb:65:in `block in call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/thin-1.6.2/lib/thin/connection.rb:86:in `block in pre_process'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/thin-1.6.2/lib/thin/connection.rb:84:in `catch'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/thin-1.6.2/lib/thin/connection.rb:84:in `pre_process'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/thin-1.6.2/lib/thin/connection.rb:53:in `process'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/thin-1.6.2/lib/thin/connection.rb:39:in `receive_data'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/thin-1.6.2/lib/thin/backends/base.rb:73:in `start'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/thin-1.6.2/lib/thin/server.rb:162:in `start'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/commands/server.rb:69:in `start'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:81:in `block in server'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `tap'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `server'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Trying to rollback...
D, [2014-10-28T15:49:02.082363 #30393] DEBUG -- :    (2.9ms)  SELECT COUNT(*) AS count FROM information_schema.tables WHERE table_schema = 'backup'
E, [2014-10-28T15:49:02.084962 #30393] ERROR -- : PG::Error: ERROR:  current transaction is aborted, commands ignored until end of transaction block
: SELECT COUNT(*) AS count FROM information_schema.tables WHERE table_schema = 'backup'
E, [2014-10-28T15:49:02.093184 #30393] ERROR -- : PG::Error: ERROR:  current transaction is aborted, commands ignored until end of transaction block
:               SELECT COUNT(*)
              FROM pg_class c
              LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
              WHERE c.relkind in ('v','r')
              AND c.relname = 'users'
              AND n.nspname = ANY (current_schemas(false))

Cleaning stuff up...
Removing tmp '/home/vagrant/vagrant/tmp/restores/default/2014-10-28-154900' directory...
Unpausing sidekiq...
Disabling readonly mode...
Marking restore as finished...
Finished!
[FAILED]

(James Milligan) #2

More information needed here, is this a Docker installation? Is it a brand new installation, or an existing one?


(Mittineague) #3

Looking for this? (found it on your Profile page)


(Bohuslav Svancara) #4

It is a new, clean developer instance in Windows (using Vagrant).
I will try it tomorrow again.
Going to the bed now…

Thank you.


#5

I have just had this issue on a brand new vagrant dev install.

The first thing I did after logging in was create a backup. Then immediately tried to restore it and got this error.


#6

The version of psql that comes in the vagrant is 9.1.8.

[vagrant@precise32:/vagrant (master)]$ psql --version
psql (PostgreSQL) 9.1.8

I am guessing this version does not support the CREATE SCHEMA IF NOT EXISTS syntax (that’s what the 9.3 release notes seem to be telling me: PostgreSQL: Documentation: devel: E.57. Release 9.3)


#7

Most of the docs describe 9.1 as being the minimum version.

Should they be changed to 9.3 so that restore is supported?

Or should the restore code be changed to work on 9.1?


(Régis Hanol) #8

I’d rather we do that one ^^ :wink:


#9

Happy to change the docs…but I have NO idea how to fix the vagrant. I can’t find a reference in chef to postgres anywhere…any ideas?