zstan commented on code in PR #2964:
URL: https://github.com/apache/ignite-3/pull/2964#discussion_r1434783030
##########
modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCreateTableDdlTest.java:
##########
@@ -298,22 +299,9 @@ public void explicitColocationColumnsCaseSensitive() {
@Test
public void doNotAllowFunctionsInNonPkColumns() {
assertThrowsSqlException(
- Sql.STMT_VALIDATION_ERR,
+ STMT_VALIDATION_ERR,
"Functional defaults are not supported for non-primary key
columns",
() -> sql("create table t (id varchar primary key, val varchar
default gen_random_uuid)")
);
}
-
- @Test
- public void dummyAlterColumnDataType() {
Review Comment:
yes this test fully covered by tests from ItAlterTableAlterColumnTest
##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java:
##########
@@ -215,39 +221,47 @@ static boolean validateColumnChange(
@Nullable Integer newLength,
TypeChangeValidationListener listener
) {
- if (newType != null && newType != origin.type()) {
- if (!isSupportedColumnTypeChange(origin.type(), newType)) {
+ if (newType != null) {
+ if (isSupportedColumnTypeChange(origin.type(), newType)) {
+ if (origin.type().precisionAllowed() && newPrecision != null
&& newPrecision < origin.precision()) {
+ listener.onFailure("Decreasing the precision for column of
type '{}' is not allowed", origin.type(), newType);
+ return false;
+ }
+
+ if (origin.type().scaleAllowed() && newScale != null &&
newScale != origin.scale()) {
+ listener.onFailure("Changing the scale for column of type
'{}' is not allowed", origin.type(), newType);
+ return false;
+ }
+
+ if (origin.type().lengthAllowed() && newLength != null &&
newLength < origin.length()) {
+ listener.onFailure("Decreasing the length for column of
type '{}' is not allowed", origin.type(), newType);
+ return false;
+ }
+
+ return true;
+ }
+
+ if (newType != origin.type()) {
Review Comment:
It`s not true
--
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]