From 7d3b16f24ca9c4050fb7a0b8c15a8c86fadee3de Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 28 Apr 2019 22:44:42 +0200 Subject: [PATCH] Ignore no-fatal errors during dump file restore The owner should never be restored, the table should be owned by the caller instead. Non-existing indexes and similar only started to throw a warning with Postgresql 9.4 and later, so ignore them explicitly there. --- lib/setup/SetupClass.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index c14190c3..d3f59296 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -753,7 +753,10 @@ class SetupFunctions private function pgsqlRunDropAndRestore($sDumpFile) { - $sCMD = 'pg_restore -p '.$this->aDSNInfo['port'].' -d '.$this->aDSNInfo['database'].' -Fc --clean '.$sDumpFile; + $sCMD = 'pg_restore -p '.$this->aDSNInfo['port'].' -d '.$this->aDSNInfo['database'].' --no-owner -Fc --clean '.$sDumpFile; + if ($this->oDB->getPostgresVersion() >= 9.04) { + $sCMD .= ' --if-exists'; + } if (isset($this->aDSNInfo['hostspec'])) { $sCMD .= ' -h '.$this->aDSNInfo['hostspec']; } -- 2.39.5