Commit f21f038f authored by unknown's avatar unknown

4.1 -> 5.0 merge


mysql-test/t/sql_mode.test:
  Auto merged
sql/sql_show.cc:
  Auto merged
mysql-test/r/sql_mode.result:
  Manual merge
parents 62dc2e0c b86d3d0a
......@@ -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")
)
......@@ -457,4 +457,24 @@ v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VI
create view v2 as select a from t2 where a in (select a from v1);
drop view v2, v1;
drop table t1, t2;
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 @@SQL_MODE=@OLD_SQL_MODE;
......@@ -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