Commit 3a00469e authored by unknown's avatar unknown

Fix for bug #4491 "timestamp(19) doesn't work".

We should allow 19 as length of newly created TIMESTAMP fields.


mysql-test/r/type_timestamp.result:
  Added test of TIMESTAMP(19) support.
mysql-test/t/type_timestamp.test:
  Added test of TIMESTAMP(19) support.
sql/sql_parse.cc:
  add_field_to_list(): TIMESTAMP columns should also support 19 as length since it is
  length of 4.1 compatible representation.
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 06cd2efc
......@@ -20,6 +20,7 @@ bell@sanja.is.com.ua
bk@admin.bk
carsten@tsort.bitbybit.dk
davida@isil.mysql.com
dlenev@brandersnatch.localdomain
dlenev@build.mysql.com
dlenev@mysql.com
gerberb@ou800.zenez.com
......
......@@ -167,3 +167,15 @@ ts1 ts2
2001-09-09 04:46:40 0000-00-00 00:00:00
2001-09-09 04:46:40 0000-00-00 00:00:00
drop table t1;
create table t1 (ts timestamp(19));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ts` timestamp(19) NOT NULL
) TYPE=MyISAM
set TIMESTAMP=1000000000;
insert into t1 values ();
select * from t1;
ts
2001-09-09 04:46:40
drop table t1;
......@@ -105,3 +105,14 @@ insert into t1 values ();
insert into t1 values (DEFAULT, DEFAULT);
select * from t1;
drop table t1;
#
# Test for bug #4491, TIMESTAMP(19) should be possible to create and not
# only read in 4.0
#
create table t1 (ts timestamp(19));
show create table t1;
set TIMESTAMP=1000000000;
insert into t1 values ();
select * from t1;
drop table t1;
......@@ -3231,8 +3231,12 @@ bool add_field_to_list(char *field_name, enum_field_types type,
case FIELD_TYPE_TIMESTAMP:
if (!length)
new_field->length= 14; // Full date YYYYMMDDHHMMSS
else
else if (new_field->length != 19)
{
/*
We support only even TIMESTAMP lengths less or equal than 14
and 19 as length of 4.1 compatible representation.
*/
new_field->length=((new_field->length+1)/2)*2; /* purecov: inspected */
new_field->length= min(new_field->length,14); /* purecov: inspected */
}
......
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