From 61543a2fd4658b7ea6f6d4e935be9c9b50e841bd Mon Sep 17 00:00:00 2001 From: Vikash Kumar Date: Mon, 19 Dec 2022 19:18:50 +0530 Subject: [PATCH 1/2] Add test for DROP TABLE IF EXISTS statement with non-existing object --- .../io/trino/execution/TestDropTableTask.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/trino-main/src/test/java/io/trino/execution/TestDropTableTask.java b/core/trino-main/src/test/java/io/trino/execution/TestDropTableTask.java index 1a13e6add44c..164a0bc37f87 100644 --- a/core/trino-main/src/test/java/io/trino/execution/TestDropTableTask.java +++ b/core/trino-main/src/test/java/io/trino/execution/TestDropTableTask.java @@ -54,6 +54,24 @@ public void testDropNotExistingTable() .hasMessage("Table '%s' does not exist", tableName); } + @Test + public void testDropTableIfExistsWithoutExistingCatalog() + { + QualifiedName tableName = QualifiedName.of("non_existing_catalog", "non_existing_schema", "not_existing_table"); + + getFutureValue(executeDropTable(tableName, true)); + // no exception + } + + @Test + public void testDropTableIfExistsWithoutExistingSchema() + { + QualifiedName tableName = QualifiedName.of(TEST_CATALOG_NAME, "non_existing_schema", "not_existing_table"); + + getFutureValue(executeDropTable(tableName, true)); + // no exception + } + @Test public void testDropNotExistingTableIfExists() { From 470843c22dd83e5e4092891aed792d2e1c7d44eb Mon Sep 17 00:00:00 2001 From: Vikash Kumar Date: Thu, 22 Dec 2022 12:17:45 +0530 Subject: [PATCH 2/2] Rename test case in TestDropTableTask --- .../src/test/java/io/trino/execution/TestDropTableTask.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/trino-main/src/test/java/io/trino/execution/TestDropTableTask.java b/core/trino-main/src/test/java/io/trino/execution/TestDropTableTask.java index 164a0bc37f87..e41288a21b04 100644 --- a/core/trino-main/src/test/java/io/trino/execution/TestDropTableTask.java +++ b/core/trino-main/src/test/java/io/trino/execution/TestDropTableTask.java @@ -73,7 +73,7 @@ public void testDropTableIfExistsWithoutExistingSchema() } @Test - public void testDropNotExistingTableIfExists() + public void testDropTableIfExistsWithoutExistingTable() { QualifiedName tableName = qualifiedName("not_existing_table"); @@ -93,7 +93,7 @@ public void testDropTableOnView() } @Test - public void testDropTableOnViewIfExists() + public void testDropTableIfExistsOnView() { QualifiedName viewName = qualifiedName("existing_view"); metadata.createView(testSession, asQualifiedObjectName(viewName), someView(), false); @@ -115,7 +115,7 @@ public void testDropTableOnMaterializedView() } @Test - public void testDropTableOnMaterializedViewIfExists() + public void testDropTableIfExistsOnMaterializedView() { QualifiedName viewName = qualifiedName("existing_materialized_view"); metadata.createMaterializedView(testSession, asQualifiedObjectName(viewName), someMaterializedView(), false, false);