summaryrefslogtreecommitdiff
path: root/mysql-test/t/create.test
diff options
context:
space:
mode:
authorunknown <anozdrin/alik@quad.opbmk>2008-03-22 11:32:24 +0300
committerunknown <anozdrin/alik@quad.opbmk>2008-03-22 11:32:24 +0300
commit28cd75fec42e327950056617c7dea8ae4d2f6395 (patch)
treeb3aa1f1d53c2b22c84865fac7a02fa96bddf0d35 /mysql-test/t/create.test
parent9965de17bab9c84472c3dc8c92f22c7d98da8f87 (diff)
downloadmariadb-git-28cd75fec42e327950056617c7dea8ae4d2f6395.tar.gz
Fix for Bug#34274: Invalid handling of 'DEFAULT 0'
for YEAR data type. The problem was that for some unknown reason 0 was not allowed as a default value for YEAR data type. That was coded before BK. However the Manual does not say a word about such a limitation. Also, it looks inconsistent with other data types. The fix is to allow 0 as a default value. mysql-test/r/create.result: Update result file. mysql-test/t/create.test: Add a test case for Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type. sql/unireg.cc: Allow 0 as a default value for YEAR data type.
Diffstat (limited to 'mysql-test/t/create.test')
-rw-r--r--mysql-test/t/create.test50
1 files changed, 49 insertions, 1 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 28ae38d943a..9cf38742289 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1365,6 +1365,8 @@ create table t1 like information_schema.character_sets;
show create table t1;
drop table t1;
+###########################################################################
+
--echo
--echo # --
--echo # -- Bug#21380: DEFAULT definition not always transfered by CREATE
@@ -1407,8 +1409,10 @@ DROP TABLE t2;
--echo
--echo # -- End of test case for Bug#21380.
---echo
+###########################################################################
+
+--echo
--echo # --
--echo # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
--echo # --
@@ -1471,6 +1475,50 @@ DROP TABLE t3;
--echo
--echo # -- End of Bug#18834.
+
+###########################################################################
+
+--echo
+--echo # --
+--echo # -- Bug#34274: Invalid handling of 'DEFAULT 0' for YEAR data type.
+--echo # --
+--echo
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo
+CREATE TABLE t1(c1 YEAR DEFAULT 2008, c2 YEAR DEFAULT 0);
+
+--echo
+SHOW CREATE TABLE t1;
+
+--echo
+INSERT INTO t1 VALUES();
+
+--echo
+SELECT * FROM t1;
+
+--echo
+ALTER TABLE t1 MODIFY c1 YEAR DEFAULT 0;
+
+--echo
+SHOW CREATE TABLE t1;
+
--echo
+INSERT INTO t1 VALUES();
+--echo
+SELECT * FROM t1;
+
+--echo
+DROP TABLE t1;
+
+--echo
+--echo # -- End of Bug#34274
+
+###########################################################################
+
+--echo
--echo End of 5.1 tests