This is an automated email from the ASF dual-hosted git repository.
xuzifu666 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new 7ed906ad8f Test case for [CALCITE-5796] DELETE statement is not
effective
7ed906ad8f is described below
commit 7ed906ad8f06fffc79db650d28440f6d13682145
Author: Yu Xu <[email protected]>
AuthorDate: Tue Sep 8 20:50:16 2026 +0800
Test case for [CALCITE-5796] DELETE statement is not effective
---
.../java/org/apache/calcite/test/ServerTest.java | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/server/src/test/java/org/apache/calcite/test/ServerTest.java
b/server/src/test/java/org/apache/calcite/test/ServerTest.java
index 0be7fb16ef..fac061dafa 100644
--- a/server/src/test/java/org/apache/calcite/test/ServerTest.java
+++ b/server/src/test/java/org/apache/calcite/test/ServerTest.java
@@ -262,6 +262,27 @@ static Connection connect() throws SQLException {
}
}
+ /** Unit test for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-5796">[CALCITE-5796]
+ * DELETE statement is not effective</a>. */
+ @Test void testDeleteAllRowsWithoutWhereClause() throws Exception {
+ try (Connection c = connect();
+ Statement s = c.createStatement()) {
+ s.execute("create table t (i int not null, j int not null)");
+ s.executeUpdate("insert into t values (1, 10)");
+ s.executeUpdate("insert into t values (2, 20)");
+ s.executeUpdate("insert into t values (3, 30)");
+
+ final int count = s.executeUpdate("delete from t");
+ assertThat(count, is(3));
+
+ try (ResultSet r = s.executeQuery("select count(*) from t")) {
+ assertThat(r.next(), is(true));
+ assertThat(r.getInt(1), is(0));
+ }
+ }
+ }
+
@Test void testStatement() throws Exception {
try (Connection c = connect();
Statement s = c.createStatement();