[MCOL-1131] Alter table fails to change the column data type Created: 2017-12-27  Updated: 2017-12-31  Resolved: 2017-12-31

Status: Closed
Project: MariaDB ColumnStore
Component/s: MariaDB Server
Affects Version/s: 1.0.11
Fix Version/s: Icebox

Type: Bug Priority: Major
Reporter: Abhinav santi Assignee: Andrew Hutchings (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Environment:

MCS AMI, 2 PMs and 1 UM


Issue Links:
Duplicate
duplicates MCOL-130 ALTER TABLE does not support changing... Closed

 Description   

Alter table fails to change the data type throws syntax error

ALTER TABLE `test`.`fact_test` CHANGE COLUMN `test12` `test12` VARCHAR(50);

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`test` VARCHAR(50)



 Comments   
Comment by Sasha V [ 2017-12-28 ]

According to the Knowledge Base: "You cannot currently use CHANGE COLUMN to change the definition of that column."
https://mariadb.com/kb/en/library/columnstore-alter-table

Comment by Abhinav santi [ 2017-12-28 ]

So is there any other way to change the column definition in columnstore?

Comment by Sasha V [ 2017-12-28 ]

I used DROP/CREATE to change the column data type. The column will be at the end of the table (MCOL-1105) and have no data.

Comment by Andrew Hutchings (Inactive) [ 2017-12-31 ]

Closed as duplicate of MCOL-130.

Comment by Andrew Hutchings (Inactive) [ 2017-12-31 ]

As for Sasha's comment you can do:

1. add column (with temporary name)
2. UPDATE TABLE SET tmp_col = orig_col to copy the data to the new column
3. drop column
4. ALTER TABLE CHANGE to rename

Generated at Thu Feb 08 02:26:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.