You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script cannot be parsed : Alter table X change column a b Double null default null;
It throws :
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered " <S_IDENTIFIER> "CHANGE "" at line 5, column 1.
Was expecting one of:
"DROP" ...
"ADD" ...
Ah, I came here looking for a solution to this issue too.
MySQL supports a query for the following form:
ALTER TABLE model CHANGE modelid modeluid INT(10) UNSIGNED NOT NULL;
As explained in this StackOverflow answer, CHANGE is used to rename a column. So what the above query means is basically "Change column modelid, rename it to modeluid, and then do the following changes to its type".
Edit: To expand this a bit, there is also a syntax for renaming tables using the ALTER statement. It is a pretty deep hole, but there is a good reference here under the header Rename column in table and Rename table
Activity
wumpz commentedon Jan 11, 2017
Pull requests are wellcome. Or is this something your want to contribute to differently ?
HeleneLf commentedon Jan 11, 2017
This is a request, not a pull request sorry, I am new to gitHub.
wumpz commentedon Jan 11, 2017
??? Where is the source code of your pull request? Did I overlooked it?
wumpz commentedon Jan 11, 2017
No problem, I was only kind of suprised ;).
liuluheng commentedon May 23, 2017
also not support
ALTER TABLEtALTER COLUMNcset default 1;wumpz commentedon May 23, 2017
Which database supports 'change'? I only know 'modify'.
Gikkman commentedon Feb 1, 2019
Ah, I came here looking for a solution to this issue too.
MySQL supports a query for the following form:
ALTER TABLE model CHANGE modelid modeluid INT(10) UNSIGNED NOT NULL;As explained in this StackOverflow answer, CHANGE is used to rename a column. So what the above query means is basically "Change column modelid, rename it to modeluid, and then do the following changes to its type".
Edit: To expand this a bit, there is also a syntax for renaming tables using the
ALTERstatement. It is a pretty deep hole, but there is a good reference here under the headerRename column in tableandRename table