Commit e43dff67 authored by ramil@mysql.com's avatar ramil@mysql.com

Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/usr/home/ram/work/mysql-5.0
parents 29cfa64f efc8404a
...@@ -1259,6 +1259,26 @@ d ...@@ -1259,6 +1259,26 @@ d
2000-10-01 2000-10-01
drop table t1; drop table t1;
set @@sql_mode='traditional'; set @@sql_mode='traditional';
create table t1(a int, b timestamp);
alter table t1 add primary key(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a int, b timestamp default 20050102030405);
alter table t1 add primary key(a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
`b` timestamp NOT NULL default '2005-01-02 03:04:05',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1(a bit(2)); create table t1(a bit(2));
insert into t1 values(b'101'); insert into t1 values(b'101');
ERROR 22001: Data too long for column 'a' at row 1 ERROR 22001: Data too long for column 'a' at row 1
......
...@@ -1119,6 +1119,20 @@ update t1 set d = 1100; ...@@ -1119,6 +1119,20 @@ update t1 set d = 1100;
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Bug #11964: alter table with timestamp field
#
set @@sql_mode='traditional';
create table t1(a int, b timestamp);
alter table t1 add primary key(a);
show create table t1;
drop table t1;
create table t1(a int, b timestamp default 20050102030405);
alter table t1 add primary key(a);
show create table t1;
drop table t1;
# #
# BIT fields # BIT fields
# #
......
...@@ -8468,7 +8468,10 @@ create_field::create_field(Field *old_field,Field *orig_field) ...@@ -8468,7 +8468,10 @@ create_field::create_field(Field *old_field,Field *orig_field)
def=0; def=0;
if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) && if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
!old_field->is_real_null() && !old_field->is_real_null() &&
old_field->ptr && orig_field) old_field->ptr && orig_field &&
(sql_type != FIELD_TYPE_TIMESTAMP || /* set def only if */
old_field->table->timestamp_field != old_field || /* timestamp field */
unireg_check == Field::TIMESTAMP_UN_FIELD)) /* has default val */
{ {
char buff[MAX_FIELD_WIDTH],*pos; char buff[MAX_FIELD_WIDTH],*pos;
String tmp(buff,sizeof(buff), charset), *res; String tmp(buff,sizeof(buff), charset), *res;
......
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