mirror of https://github.com/citusdata/citus.git
Adds If exists statement for drop database
parent
4087d1941d
commit
e5a6b7880c
|
@ -259,8 +259,10 @@ DeparseCreateDatabaseStmt(Node *node)
|
||||||
static void
|
static void
|
||||||
AppendDropDatabaseStmt(StringInfo buf, DropdbStmt *stmt)
|
AppendDropDatabaseStmt(StringInfo buf, DropdbStmt *stmt)
|
||||||
{
|
{
|
||||||
|
char *if_exists_statement = stmt->missing_ok ? "IF EXISTS" : "";
|
||||||
appendStringInfo(buf,
|
appendStringInfo(buf,
|
||||||
"DROP DATABASE %s",
|
"DROP DATABASE %s %s",
|
||||||
|
if_exists_statement,
|
||||||
quote_identifier(stmt->dbname));
|
quote_identifier(stmt->dbname));
|
||||||
|
|
||||||
DefElem *option = NULL;
|
DefElem *option = NULL;
|
||||||
|
|
|
@ -112,10 +112,10 @@ DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||||
NOTICE: issuing SELECT pg_catalog.citus_internal_database_command('CREATE DATABASE "mydatabase#1''2"')
|
NOTICE: issuing SELECT pg_catalog.citus_internal_database_command('CREATE DATABASE "mydatabase#1''2"')
|
||||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||||
set citus.grep_remote_commands = '%DROP DATABASE%';
|
set citus.grep_remote_commands = '%DROP DATABASE%';
|
||||||
drop database "mydatabase#1'2";
|
drop database if exists "mydatabase#1'2";
|
||||||
NOTICE: issuing SELECT pg_catalog.citus_internal_database_command('DROP DATABASE "mydatabase#1''2"')
|
NOTICE: issuing SELECT pg_catalog.citus_internal_database_command('DROP DATABASE IF EXISTS "mydatabase#1''2"')
|
||||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||||
NOTICE: issuing SELECT pg_catalog.citus_internal_database_command('DROP DATABASE "mydatabase#1''2"')
|
NOTICE: issuing SELECT pg_catalog.citus_internal_database_command('DROP DATABASE IF EXISTS "mydatabase#1''2"')
|
||||||
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
|
||||||
--clean up resources created by this test
|
--clean up resources created by this test
|
||||||
drop tablespace create_drop_db_tablespace;
|
drop tablespace create_drop_db_tablespace;
|
||||||
|
|
|
@ -102,7 +102,7 @@ set citus.grep_remote_commands = '%CREATE DATABASE%';
|
||||||
create database "mydatabase#1'2";
|
create database "mydatabase#1'2";
|
||||||
|
|
||||||
set citus.grep_remote_commands = '%DROP DATABASE%';
|
set citus.grep_remote_commands = '%DROP DATABASE%';
|
||||||
drop database "mydatabase#1'2";
|
drop database if exists "mydatabase#1'2";
|
||||||
|
|
||||||
--clean up resources created by this test
|
--clean up resources created by this test
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue