From 3aac61cfa74c0ca6816ddebed7e955519c11b9e2 Mon Sep 17 00:00:00 2001 From: Serge Skripchuk Date: Sun, 13 Aug 2017 15:33:04 +0300 Subject: [PATCH] [ticket/15319] Add IF EXISTS to Postgres DROP SEQUENCE query --- phpBB/phpbb/db/extractor/postgres_extractor.php | 2 +- phpBB/phpbb/db/tools/postgres.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/db/extractor/postgres_extractor.php b/phpBB/phpbb/db/extractor/postgres_extractor.php index a98e39621c..0219d2ac8d 100644 --- a/phpBB/phpbb/db/extractor/postgres_extractor.php +++ b/phpBB/phpbb/db/extractor/postgres_extractor.php @@ -85,7 +85,7 @@ class postgres_extractor extends base_extractor // We don't even care about storing the results. We already know the answer if we get rows back. if ($this->db->sql_fetchrow($result)) { - $sql_data .= "DROP SEQUENCE {$table_name}_seq;\n"; + $sql_data .= "DROP SEQUENCE IF EXISTS {$table_name}_seq;\n"; $sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n"; } $this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/db/tools/postgres.php b/phpBB/phpbb/db/tools/postgres.php index e2a4e668a6..077d6e06f9 100644 --- a/phpBB/phpbb/db/tools/postgres.php +++ b/phpBB/phpbb/db/tools/postgres.php @@ -448,7 +448,7 @@ class postgres extends tools // We don't even care about storing the results. We already know the answer if we get rows back. if ($this->db->sql_fetchrow($result)) { - $statements[] = "DROP SEQUENCE {$table_name}_seq;\n"; + $statements[] = "DROP SEQUENCE IF EXISTS {$table_name}_seq;\n"; } $this->db->sql_freeresult($result);