summaryrefslogtreecommitdiff
path: root/mysql-test/t/alter_table.test
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-06-03 22:52:02 -0700
committerunknown <igor@olga.mysql.com>2007-06-03 22:52:02 -0700
commitf4caa3025a437ca818fdef152321c3c02b2dabd6 (patch)
tree9bfac4f842371d84eebd379e361ab3df1e3bf0f0 /mysql-test/t/alter_table.test
parent0484d44eebff70ef5a2c328c7a9d50ac07a89409 (diff)
parent92fb5da3728651ee4f2f72d73efa8a89a5d4f764 (diff)
downloadmariadb-git-f4caa3025a437ca818fdef152321c3c02b2dabd6.tar.gz
Merge olga.mysql.com:/home/igor/mysql-5.1
into olga.mysql.com:/home/igor/mysql-5.1-opt-merge mysql-test/r/alter_table.result: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/t/alter_table.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/strict.test: Auto merged mysql-test/t/subselect3.test: Auto merged sql/field.h: Auto merged sql/handler.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/mysqld.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_update.cc: Auto merged mysql-test/r/ps_2myisam.result: Manual merge. mysql-test/r/ps_3innodb.result: Manual merge. mysql-test/r/ps_4heap.result: Manual merge. mysql-test/r/ps_5merge.result: Manual merge. mysql-test/r/ps_7ndb.result: Manual merge. sql/sql_table.cc: Manual merge. sql/sql_view.cc: Manual merge.
Diffstat (limited to 'mysql-test/t/alter_table.test')
-rw-r--r--mysql-test/t/alter_table.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 7d3e9bba533..fa50d75b8d2 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -631,6 +631,30 @@ insert into t1 values (null);
select * from t1;
drop table t1;
+
+#
+# Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the
+# NO_ZERO_DATE mode.
+#
+set @orig_sql_mode = @@sql_mode;
+set sql_mode="no_zero_date";
+create table t1(f1 int);
+alter table t1 add column f2 datetime not null, add column f21 date not null;
+insert into t1 values(1,'2000-01-01','2000-01-01');
+--error 1292
+alter table t1 add column f3 datetime not null;
+--error 1292
+alter table t1 add column f3 date not null;
+--error 1292
+alter table t1 add column f4 datetime not null default '2002-02-02',
+ add column f41 date not null;
+alter table t1 add column f4 datetime not null default '2002-02-02',
+ add column f41 date not null default '2002-02-02';
+select * from t1;
+drop table t1;
+set sql_mode= @orig_sql_mode;
+
+#
# Some additional tests for new, faster alter table. Note that most of the
# whole alter table code is being tested all around the test suite already.
#
@@ -866,3 +890,15 @@ ALTER TABLE t2 MODIFY unsigned_int_field BIGINT UNSIGNED NOT NULL;
DESCRIBE t2;
DROP TABLE t2;
+
+#
+# Bug#28427: Columns were renamed instead of moving by ALTER TABLE.
+#
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
+INSERT INTO t1 VALUES (1, 2, NULL);
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f1;
+SELECT * FROM t1;
+ALTER TABLE t1 MODIFY COLUMN f3 INT AFTER f2;
+SELECT * FROM t1;
+DROP TABLE t1;