korlov42 commented on code in PR #5450:
URL: https://github.com/apache/ignite-3/pull/5450#discussion_r2016117054
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java:
##########
@@ -562,25 +555,40 @@ private CatalogCommand
convertAlterColumn(IgniteSqlAlterColumn alterColumnNode,
builder.nullable(!notNull);
}
- if (alterColumnNode.expression() != null) {
- SqlNode expr = alterColumnNode.expression();
+ SqlNode defaultExpr = alterColumnNode.expression();
+ if (defaultExpr != null) {
+ String columnName = alterColumnNode.name().getSimple();
+ Pair<DefaultValue.Type, DeferredDefaultValue> resolveDfltFunc =
convertDefaultExpression(defaultExpr, columnName, relType);
- DeferredDefaultValue resolveDfltFunc;
+ if (resolveDfltFunc.getFirst() != Type.CONSTANT) {
+ throw new SqlException(STMT_VALIDATION_ERR, "Cannot set
functional default: " + defaultExpr);
Review Comment:
The message is quite confusing: one might think the problem in particular
expression while we don't allow assignment of non-constant default after table
creation. Let's change it to something like "Non-constant default cannot be
assigned after table creation" or something like that.
BTW, does It make sense to move this validation to catalog?
--
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]