From f9351e4fb59f72f0417e14757c76ed69a1eb1805 Mon Sep 17 00:00:00 2001 From: Niwaka <61189782+NiwakaDev@users.noreply.github.com> Date: Mon, 25 Sep 2023 15:23:16 +0900 Subject: [PATCH] chore: add integration test for issue2437 (#2481) --- .../common/alter/add_incorrect_col.result | 25 +++++++++++++++++++ .../common/alter/add_incorrect_col.sql | 9 +++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/cases/standalone/common/alter/add_incorrect_col.result create mode 100644 tests/cases/standalone/common/alter/add_incorrect_col.sql diff --git a/tests/cases/standalone/common/alter/add_incorrect_col.result b/tests/cases/standalone/common/alter/add_incorrect_col.result new file mode 100644 index 000000000000..1f8d90b575f3 --- /dev/null +++ b/tests/cases/standalone/common/alter/add_incorrect_col.result @@ -0,0 +1,25 @@ +CREATE TABLE table_should_not_break_after_incorrect_alter(i INTEGER, j TIMESTAMP TIME INDEX); + +Affected Rows: 0 + +ALTER TABLE table_should_not_break_after_incorrect_alter ADD column k string NOT NULL; + +Error: 1004(InvalidArguments), Invalid alter table(table_should_not_break_after_incorrect_alter) request: no default value for column k + +INSERT INTO table_should_not_break_after_incorrect_alter VALUES (1, 1), (2, 2); + +Affected Rows: 2 + +SELECT * FROM table_should_not_break_after_incorrect_alter; + ++---+-------------------------+ +| i | j | ++---+-------------------------+ +| 1 | 1970-01-01T00:00:00.001 | +| 2 | 1970-01-01T00:00:00.002 | ++---+-------------------------+ + +DROP TABLE table_should_not_break_after_incorrect_alter; + +Affected Rows: 1 + diff --git a/tests/cases/standalone/common/alter/add_incorrect_col.sql b/tests/cases/standalone/common/alter/add_incorrect_col.sql new file mode 100644 index 000000000000..677c85eb1232 --- /dev/null +++ b/tests/cases/standalone/common/alter/add_incorrect_col.sql @@ -0,0 +1,9 @@ +CREATE TABLE table_should_not_break_after_incorrect_alter(i INTEGER, j TIMESTAMP TIME INDEX); + +ALTER TABLE table_should_not_break_after_incorrect_alter ADD column k string NOT NULL; + +INSERT INTO table_should_not_break_after_incorrect_alter VALUES (1, 1), (2, 2); + +SELECT * FROM table_should_not_break_after_incorrect_alter; + +DROP TABLE table_should_not_break_after_incorrect_alter;