diff options
author | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-10-09 14:41:04 +0200 |
---|---|---|
committer | Tatiana A. Nurnberg <azundris@mysql.com> | 2009-10-09 14:41:04 +0200 |
commit | 798ce98340ded50323522aa436c4102e86a829a9 (patch) | |
tree | e7a14619a96812db600156dc17255efec6917ac5 /mysql-test/t/alter_table.test | |
parent | fce4fa362c5234f1e85212060f61b842844192b7 (diff) | |
parent | 74deaae946f060318900b93249e1d48f4d43c9af (diff) | |
download | mariadb-git-798ce98340ded50323522aa436c4102e86a829a9.tar.gz |
Bug#43508: Renaming timestamp or date column triggers table copy
We set up DATE and TIMESTAMP differently in field-creation than we
did in field-MD creation (for CREATE). Admirably, ALTER TABLE
detected this and didn't damage any data, but it did initiate a
full copy/conversion, which we don't really need to do.
Now we describe Field and Create_field the same for those types.
As a result, ALTER TABLE that only changes meta-data (like a
field's name) no longer forces a data-copy when there needn't
be one.
mysql-test/r/alter_table.result:
0 rows should be affected when a meta-data change is enough ALTER TABLE.
mysql-test/t/alter_table.test:
add test-case: show that we don't do a full data-copy on ALTER TABLE
when we don't need to.
sql/field.cc:
Remove Field_str::compare_str_field_flags() (now in Field/Create_field as
field_flags_are_binary().
Correct some field-lengths!
sql/field.h:
Clean-up: use defined constants rather than numeric literals for certain
field-lengths.
Add enquiry-functions binaryp() to classes Field and Create_field.
This replaces field.cc's Field_str::compare_str_field_flags().
Diffstat (limited to 'mysql-test/t/alter_table.test')
-rw-r--r-- | mysql-test/t/alter_table.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index ae48d5a8736..6f36a8a02b5 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1000,4 +1000,19 @@ ALTER TABLE t1 MODIFY b ENUM('a', 'z', 'b', 'c') NOT NULL; SELECT * FROM t1; DROP TABLE t1; +# +# Bug#43508: Renaming timestamp or date column triggers table copy +# + +CREATE TABLE t1 (f1 TIMESTAMP NULL DEFAULT NULL, + f2 INT(11) DEFAULT NULL) ENGINE=MYISAM DEFAULT CHARSET=utf8; + +INSERT INTO t1 VALUES (NULL, NULL), ("2009-10-09 11:46:19", 2); + +--echo this should affect no rows as there is no real change +--enable_info +ALTER TABLE t1 CHANGE COLUMN f1 f1_no_real_change TIMESTAMP NULL DEFAULT NULL; +--disable_info +DROP TABLE t1; + --echo End of 5.1 tests |