Commit a3c014ca authored by unknown's avatar unknown

Merge mysql.com:/home/mydev/mysql-4.1-4100

into  mysql.com:/home/mydev/mysql-5.0-5000


mysql-test/r/merge.result:
  Auto merged
mysql-test/t/merge.test:
  Auto merged
mysql-test/t/sql_mode.test:
  Auto merged
sql/sql_show.cc:
  Auto merged
mysql-test/r/sql_mode.result:
  SCCS merged
parents b65c76cb 48838170
......@@ -669,15 +669,15 @@ b varchar(10),
index (a,b)
) engine=myisam;
insert into t2 values ( null, '');
insert into t2 values ( 9999999999.9999, '');
insert into t2 values ( 9999999999.999, '');
insert into t3 select * from t2;
select min(a), max(a) from t1;
min(a) max(a)
9999999999.9999 9999999999.9999
9999999999.9990 9999999999.9990
flush tables;
select min(a), max(a) from t1;
min(a) max(a)
9999999999.9999 9999999999.9999
9999999999.9990 9999999999.9990
drop table t1, t2, t3;
create table t1 (a int,b int,c int, index (a,b,c));
create table t2 (a int,b int,c int, index (a,b,c));
......
......@@ -65,7 +65,7 @@ sql_mode NO_FIELD_OPTIONS,MYSQL323,MYSQL40,HIGH_NOT_PRECEDENCE
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL auto_increment,
`a` int(11) NOT NULL,
`pseudo` varchar(35) NOT NULL default '',
`email` varchar(60) NOT NULL default '',
PRIMARY KEY (`a`),
......@@ -79,8 +79,8 @@ show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"a" int(11) NOT NULL,
"pseudo" varchar(35) NOT NULL default '',
"email" varchar(60) NOT NULL default '',
"pseudo" varchar(35) character set latin2 NOT NULL default '',
"email" varchar(60) character set latin2 NOT NULL default '',
PRIMARY KEY ("a"),
UNIQUE KEY "email" ("email")
)
......@@ -140,6 +140,26 @@ t1 CREATE TABLE `t1` (
drop table t1 ;
set @@SQL_MODE=NULL;
ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
set session sql_mode=ansi;
create table t1
(f1 integer auto_increment primary key,
f2 timestamp default current_timestamp on update current_timestamp);
show create table t1;
Table Create Table
t1 CREATE TABLE "t1" (
"f1" int(11) NOT NULL auto_increment,
"f2" timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY ("f1")
)
set session sql_mode=no_field_options;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
`f2` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`f1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='';
show local variables like 'SQL_MODE';
Variable_name Value
......
......@@ -314,7 +314,7 @@ create table t3 (
) engine=myisam;
insert into t2 values ( null, '');
insert into t2 values ( 9999999999.9999, '');
insert into t2 values ( 9999999999.999, '');
insert into t3 select * from t2;
select min(a), max(a) from t1;
flush tables;
......
......@@ -86,6 +86,18 @@ drop table t1 ;
--error 1231
set @@SQL_MODE=NULL;
#
# Bug #797: in sql_mode=ANSI, show create table ignores auto_increment
#
set session sql_mode=ansi;
create table t1
(f1 integer auto_increment primary key,
f2 timestamp default current_timestamp on update current_timestamp);
show create table t1;
set session sql_mode=no_field_options;
show create table t1;
drop table t1;
# End of 4.1 tests
#
......
......@@ -794,7 +794,8 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
field->sql_type(type);
packet->append(type.ptr(), type.length(), system_charset_info);
if (field->has_charset() && !limited_mysql_mode && !foreign_db_mode)
if (field->has_charset() &&
!(thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)))
{
if (field->charset() != share->table_charset)
{
......@@ -833,7 +834,7 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
has_default= (field->type() != FIELD_TYPE_BLOB &&
!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
field->unireg_check != Field::NEXT_NUMBER &&
!((foreign_db_mode || limited_mysql_mode) &&
!((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) &&
has_now_default));
if (has_default)
......@@ -863,12 +864,13 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet)
packet->append(tmp);
}
if (!foreign_db_mode && !limited_mysql_mode &&
if (!(thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS) &&
table->timestamp_field == field &&
field->unireg_check != Field::TIMESTAMP_DN_FIELD)
packet->append(" on update CURRENT_TIMESTAMP",28);
if (field->unireg_check == Field::NEXT_NUMBER && !foreign_db_mode)
if (field->unireg_check == Field::NEXT_NUMBER &&
!(thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS))
packet->append(" auto_increment", 15 );
if (field->comment.length)
......
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