A platform for community discussion. Free, open, simple.
FIX: Strip SET transaction_timeout when restoring backups
Jake Goldsborough7c03546b897a
diff --git a/lib/backup_restore/database_restorer.rb b/lib/backup_restore/database_restorer.rbindex c146dba8a27..bdea8aba2cd 100644--- a/lib/backup_restore/database_restorer.rb+++ b/lib/backup_restore/database_restorer.rb@@ -102,6 +102,7 @@ module BackupRestore"CREATE SCHEMA", # PostgreSQL 11+"COMMENT ON SCHEMA", # PostgreSQL 11+"SET default_table_access_method", # PostgreSQL 12+ "SET transaction_timeout", # PostgreSQL 17"CREATE EXTENSION","COMMENT ON EXTENSION","\\\\restrict",diff --git a/spec/fixtures/db/restore/unwanted.sql b/spec/fixtures/db/restore/unwanted.sqlindex 8b475e50a46..d265e96477e 100644--- a/spec/fixtures/db/restore/unwanted.sql+++ b/spec/fixtures/db/restore/unwanted.sql@@ -10,6 +10,7 @@SET statement_timeout = 0;SET lock_timeout = 0;SET idle_in_transaction_session_timeout = 0;+SET transaction_timeout = 0;SET client_encoding = 'UTF8';SET standard_conforming_strings = on;SELECT pg_catalog.set_config('search_path', '', false);diff --git a/spec/lib/backup_restore/database_restorer_spec.rb b/spec/lib/backup_restore/database_restorer_spec.rbindex 41ce282e288..e36d01c3181 100644--- a/spec/lib/backup_restore/database_restorer_spec.rb+++ b/spec/lib/backup_restore/database_restorer_spec.rb@@ -147,6 +147,7 @@ RSpec.describe BackupRestore::DatabaseRestorer doexpect(log).to include("CREATE TABLE public.foo")expect(log).not_to be_blank+ expect(log).not_to include("SET transaction_timeout")expect(log).not_to include("CREATE EXTENSION")expect(log).not_to include("COMMENT ON EXTENSION")expect(log).not_to include(