Commit 9d4b5896 authored by unknown's avatar unknown

Fix for bug #7418 "TIMESTAMP not always converted to DATETIME in MAXDB

mode".

Changed grammar rule for "type" token. Now we have one branch with 
optional length specification for TIMESTAMP type instead of two separate
branches.


mysql-test/r/type_timestamp.result:
  Added test case for bug #7418 "TIMESTAMP not always converted to DATETIME
  in MAXDB mode".
mysql-test/t/type_timestamp.test:
  Added test case for bug #7418 "TIMESTAMP not always converted to DATETIME
  in MAXDB mode".
sql/sql_yacc.yy:
  Changed rule for "type" token. Now we have one branch with optional
  length specification for TIMESTAMP type instead of two separate branches.
  This also gives us consistent behavior for TIMETSAMP in MAXDB mode.
parent 58f24e42
......@@ -422,3 +422,13 @@ max(t)
2004-01-01 01:00:00
2004-02-01 00:00:00
drop table t1;
set sql_mode='maxdb';
create table t1 (a timestamp, b timestamp(19));
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" datetime default NULL,
"b" datetime default NULL
)
set sql_mode='';
drop table t1;
......@@ -286,3 +286,15 @@ insert into t1 values ('a', '2004-01-01 00:00:00'), ('a', '2004-01-01 01:00:00')
('b', '2004-02-01 00:00:00');
select max(t) from t1 group by a;
drop table t1;
#
# Test for bug #7418 "TIMESTAMP not always converted to DATETIME in MAXDB
# mode". TIMESTAMP columns should be converted DATETIME columns in MAXDB
# mode regardless of whether a display width is given.
#
set sql_mode='maxdb';
create table t1 (a timestamp, b timestamp(19));
show create table t1;
# restore default mode
set sql_mode='';
drop table t1;
......@@ -1415,7 +1415,7 @@ type:
| YEAR_SYM opt_len field_options { $$=FIELD_TYPE_YEAR; }
| DATE_SYM { $$=FIELD_TYPE_DATE; }
| TIME_SYM { $$=FIELD_TYPE_TIME; }
| TIMESTAMP
| TIMESTAMP opt_len
{
if (YYTHD->variables.sql_mode & MODE_MAXDB)
$$=FIELD_TYPE_DATETIME;
......@@ -1428,13 +1428,6 @@ type:
$$=FIELD_TYPE_TIMESTAMP;
}
}
| TIMESTAMP '(' NUM ')'
{
LEX *lex= Lex;
lex->length= $3.str;
lex->type|= NOT_NULL_FLAG;
$$= FIELD_TYPE_TIMESTAMP;
}
| DATETIME { $$=FIELD_TYPE_DATETIME; }
| TINYBLOB { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_TINY_BLOB; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment