[ https://issues.apache.org/jira/browse/IGNITE-19407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17730042#comment-17730042 ]
Pavel Pereslegin commented on IGNITE-19407: ------------------------------------------- Command syntax: {code:java} ALTER TABLE <table_name> ALTER COLUMN <col_name> <action>; <action> ::= SET DATA TYPE <new_type> [NOT NULL | NULLABLE] [DEFAULT <default value>]| SET NOT NULL | DROP NOT NULL | SET DEFAULT <default value> | DROP DEFAULT{code} Example of changing the data type and dropping NOT NULL at the same time: {code:java} SET DATA TYPE BIGINT NULLABLE{code} Example of changing the data type and dropping default at the same time: {code:java} SET DATA TYPE BIGINT DEFAULT NULL{code} List of possible actions to change the column. - NOT NULL -> NULLABLE allowed for any non-PK column. - NULLABLE -> NOT NULL forbidden. - DEFAULT -> ANY LITERAL DEFAULT allowed for any column. - DROP DEFAULT / SET DEFAULT NULL allowed for any column. - TYPE SCALE change forbidden - a. TYPE PRECISION increase allowed for DECIMAL non PK column - b. TYPE LENGTH increase allowed for STRING and BYTE_ARRAY non PK column. - The following type transitions allowed for TYPE of non PK column: FLOAT -> DOUBLE INT8 -> INT16 -> INT32 -< INT64 Any other type transitions are forbidden. > Sql. Introduce DDL command for ALTER COLUMN TYPE. > ------------------------------------------------- > > Key: IGNITE-19407 > URL: https://issues.apache.org/jira/browse/IGNITE-19407 > Project: Ignite > Issue Type: Improvement > Components: sql > Reporter: Andrey Mashenkov > Assignee: Pavel Pereslegin > Priority: Major > Labels: ignite-3 > Fix For: 3.0.0-beta2 > > Time Spent: 5.5h > Remaining Estimate: 0h > > Introduce DDL command class. > Implement command validation logic. > Pass command to the CatalogService via DdlHandler. > Validator should allow changing column DEFAULT and changing column type for > the next cases > {noformat} > INT8 -> INT16 -> INT32 -> INT64 > FLOAT -> DOUBLE > DECIMAL(10,5) -> DECIMAL(15, 5) // increasing precision only > VARCHAR(10) -> VARCHAR(20) > VARBINARY(10) -> VARBINARY(20) > NOT NULL -> NULLABLE > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)