We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When renaming a column and then re-creating it within the same ALTER statement, gh-ost deletes the entiretity of the name-changed column.
Example:
-- regular alter table (expected behaviour) CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY auto_increment, c1 VARCHAR(100), c2 VARCHAR(100)); INSERT INTO t1 (c1, c2) VALUES ('a', 'b'), ('c', 'd'), ('e', 'f'); ALTER TABLE t1 RENAME COLUMN c1 TO n1, ADD COLUMN c1 varchar(100); SELECT * FROM t1; +----+------+------+------+ | id | n1 | c2 | c1 | +----+------+------+------+ | 1 | a | b | NULL | | 2 | c | d | NULL | | 3 | e | f | NULL | +----+------+------+------+
Using gh-ost:
go run . \ --max-load=Threads_running=25 \ --critical-load=Threads_running=1000 \ --chunk-size=1000 \ --user="[REDACTED]" \ --password="[REDACTED]" \ --host="127.0.0.1" \ --port=8030 \ --allow-on-master \ --database="test" \ --table="t1" \ --verbose \ --initially-drop-old-table \ --ok-to-drop-table \ --execute --initially-drop-ghost-table --alter="RENAME COLUMN c1 TO n1, ADD COLUMN c1 varchar(100)"
Result:
+----+------+------+------+ | id | n1 | c2 | c1 | +----+------+------+------+ | 1 | NULL | b | a | | 2 | NULL | d | c | | 3 | NULL | f | e | +----+------+------+------+
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When renaming a column and then re-creating it within the same ALTER statement, gh-ost deletes the entiretity of the name-changed column.
Example:
Using gh-ost:
Result:
The text was updated successfully, but these errors were encountered: