mirror of https://github.com/citusdata/citus.git
Don't throw error for DROP DATABASE IF EXISTS
parent
28d307850c
commit
3e00bf1c0d
|
@ -549,11 +549,15 @@ multi_ProcessUtility(PlannedStmt *pstmt,
|
||||||
*/
|
*/
|
||||||
if (IsA(parsetree, DropdbStmt))
|
if (IsA(parsetree, DropdbStmt))
|
||||||
{
|
{
|
||||||
|
const bool missingOK = true;
|
||||||
DropdbStmt *dropDbStatement = (DropdbStmt *) parsetree;
|
DropdbStmt *dropDbStatement = (DropdbStmt *) parsetree;
|
||||||
char *dbname = dropDbStatement->dbname;
|
char *dbname = dropDbStatement->dbname;
|
||||||
Oid databaseOid = get_database_oid(dbname, false);
|
Oid databaseOid = get_database_oid(dbname, missingOK);
|
||||||
|
|
||||||
StopMaintenanceDaemon(databaseOid);
|
if (OidIsValid(databaseOid))
|
||||||
|
{
|
||||||
|
StopMaintenanceDaemon(databaseOid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set user if needed and go ahead and run local utility using standard hook */
|
/* set user if needed and go ahead and run local utility using standard hook */
|
||||||
|
|
|
@ -268,3 +268,10 @@ FETCH BACKWARD noHoldCursor;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
FETCH ABSOLUTE 5 FROM noHoldCursor;
|
FETCH ABSOLUTE 5 FROM noHoldCursor;
|
||||||
ERROR: cursor "noholdcursor" does not exist
|
ERROR: cursor "noholdcursor" does not exist
|
||||||
|
-- Test we don't throw an error for DROP IF EXISTS
|
||||||
|
DROP DATABASE IF EXISTS not_existing_database;
|
||||||
|
NOTICE: database "not_existing_database" does not exist, skipping
|
||||||
|
DROP TABLE IF EXISTS not_existing_table;
|
||||||
|
NOTICE: table "not_existing_table" does not exist, skipping
|
||||||
|
DROP SCHEMA IF EXISTS not_existing_schema;
|
||||||
|
NOTICE: schema "not_existing_schema" does not exist, skipping
|
||||||
|
|
|
@ -146,3 +146,8 @@ FETCH ABSOLUTE 5 FROM noHoldCursor;
|
||||||
FETCH BACKWARD noHoldCursor;
|
FETCH BACKWARD noHoldCursor;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
FETCH ABSOLUTE 5 FROM noHoldCursor;
|
FETCH ABSOLUTE 5 FROM noHoldCursor;
|
||||||
|
|
||||||
|
-- Test we don't throw an error for DROP IF EXISTS
|
||||||
|
DROP DATABASE IF EXISTS not_existing_database;
|
||||||
|
DROP TABLE IF EXISTS not_existing_table;
|
||||||
|
DROP SCHEMA IF EXISTS not_existing_schema;
|
||||||
|
|
Loading…
Reference in New Issue