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

into  mysql.com:/usr/home/ram/work/mysql-5.0


sql/field.cc:
  Auto merged
mysql-test/r/strict.result:
  merging
mysql-test/t/strict.test:
  merging
This commit is contained in:
unknown 2005-07-27 15:09:06 +05:00
commit 71e8b59126
3 changed files with 38 additions and 1 deletions

View File

@ -1259,6 +1259,26 @@ d
2000-10-01
drop table t1;
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));
insert into t1 values(b'101');
ERROR 22001: Data too long for column 'a' at row 1

View File

@ -1119,6 +1119,20 @@ update t1 set d = 1100;
select * from 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
#

View File

@ -8468,7 +8468,10 @@ create_field::create_field(Field *old_field,Field *orig_field)
def=0;
if (!(flags & (NO_DEFAULT_VALUE_FLAG | BLOB_FLAG)) &&
!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;
String tmp(buff,sizeof(buff), charset), *res;