summaryrefslogtreecommitdiff
path: root/mysql-test/r/alter_table.result
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2007-06-02 01:21:18 +0400
committerevgen@moonbone.local <>2007-06-02 01:21:18 +0400
commitfc01b0995d92aea1ca2ed790df37362a290df689 (patch)
tree405488e4121249e547e773c0c60fc6bb67cf41be /mysql-test/r/alter_table.result
parenta24a38df75994ff82e1afbfbfe0ec35b42f3dabf (diff)
downloadmariadb-git-fc01b0995d92aea1ca2ed790df37362a290df689.tar.gz
Bug#28427: Columns were renamed instead of moving by ALTER TABLE.
To avoid unnecessary work the mysql_alter_table function takes the list of table fields and applies all changes to it (drops/moves/renames/etc). Then this function compares the new list and the old one. If the changes require only .frm to be modified then the actual data isn't copied. To detect changes all columns attributes but names are compared. When a column has been moved and has replaced another column with the same attributes except name the mysql_alter_table function wrongly decides that two fields has been just renamed. As a result the data from the moved column and from all columns after it is not copied. Now the mysql_alter_table function forces table data copying by setting the need_copy_table flag when it finds a moved column. The flag is set at the stage when the modified fields are created.
Diffstat (limited to 'mysql-test/r/alter_table.result')
-rw-r--r--mysql-test/r/alter_table.result14
1 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 3fa12f2997a..c9e3655660b 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -1103,3 +1103,17 @@ Field Type Null Key Default Extra
unsigned_int_field bigint(20) unsigned NO MUL
char_field char(10) YES NULL
DROP TABLE t2;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
+INSERT INTO t1 VALUES (1, 2, NULL);
+SELECT * FROM t1;
+f1 f2 f3
+1 2 NULL
+ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f1;
+SELECT * FROM t1;
+f1 f3 f2
+1 NULL 2
+ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f2;
+SELECT * FROM t1;
+f1 f2 f3
+1 2 NULL
+DROP TABLE t1;