AMashenkov commented on code in PR #7640:
URL: https://github.com/apache/ignite-3/pull/7640#discussion_r2840398000
##########
modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItAlterTableDdlTest.java:
##########
@@ -240,6 +240,26 @@ public void doNotAllowFunctionsInNonPkColumns() {
);
}
+ @Test
+ public void cannotAddNonNullableColumnWithoutDefault() {
+ sql("CREATE TABLE t (id VARCHAR PRIMARY KEY)");
+
+ assertThrowsSqlException(
+ STMT_VALIDATION_ERR,
+ "Non-nullable column 'VAL' must have the default value",
+ () -> sql("ALTER TABLE t ADD COLUMN val VARCHAR NOT NULL")
+ );
+
+ assertThrowsSqlException(
+ STMT_VALIDATION_ERR,
+ "Non-nullable column 'VAL' must have the default value",
+ () -> sql("ALTER TABLE t ADD COLUMN val VARCHAR NOT NULL
DEFAULT NULL")
+ );
+
+ // Should not throw an exception since default value is provided.
+ sql("ALTER TABLE t ADD COLUMN val VARCHAR NOT NULL DEFAULT 'a'");
Review Comment:
Got it.
We have no e2e test for changing non-nullable column `ALTER COLUMN SET
DEFAULT NULL`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]