Commit 095e2527 authored by unknown's avatar unknown
Browse files

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

into  bodhi.local:/opt/local/work/mysql-5.0-runtime

parents 7118b2c3 2ba119c6
Loading
Loading
Loading
Loading
+117 −0
Original line number Diff line number Diff line
@@ -1055,6 +1055,73 @@ EXECUTE stmt USING @a;
0	0
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (i INT);
PREPARE st_19182
FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1";
EXECUTE st_19182;
DESC t2;
Field	Type	Null	Key	Default	Extra
j	int(11)	YES	MUL	NULL	
i	int(11)	YES	MUL	NULL	
DROP TABLE t2;
EXECUTE st_19182;
DESC t2;
Field	Type	Null	Key	Default	Extra
j	int(11)	YES	MUL	NULL	
i	int(11)	YES	MUL	NULL	
DEALLOCATE PREPARE st_19182;
DROP TABLE t2, t1;
drop database if exists mysqltest;
drop table if exists t1, t2;
create database mysqltest character set utf8;
prepare stmt1 from "create table mysqltest.t1 (c char(10))";
prepare stmt2 from "create table mysqltest.t2 select 'test'";
execute stmt1;
execute stmt2;
show create table mysqltest.t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
show create table mysqltest.t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `test` varchar(4) character set latin1 NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table mysqltest.t1;
drop table mysqltest.t2;
alter database mysqltest character set latin1;
execute stmt1;
execute stmt2;
show create table mysqltest.t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c` char(10) character set utf8 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table mysqltest.t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `test` varchar(4) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop database mysqltest;
deallocate prepare stmt1;
deallocate prepare stmt2;
execute stmt;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
execute stmt;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `c` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
deallocate prepare stmt;
End of 4.1 tests.
create table t1 (a varchar(20));
insert into t1 values ('foo');
@@ -1536,4 +1603,54 @@ a
2
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2;
drop table if exists t1;
create table t1 (s1 char(20));
prepare stmt from "alter table t1 modify s1 int";
execute stmt;
execute stmt;
drop table t1;
deallocate prepare stmt;
drop table if exists t1;
create table t1 (a int, b int);
prepare s_6895 from "alter table t1 drop column b";
execute s_6895;
show columns from t1;
Field	Type	Null	Key	Default	Extra
a	int(11)	YES		NULL	
drop table t1;
create table t1 (a int, b int);
execute s_6895;
show columns from t1;
Field	Type	Null	Key	Default	Extra
a	int(11)	YES		NULL	
drop table t1;
create table t1 (a int, b int);
execute s_6895;
show columns from t1;
Field	Type	Null	Key	Default	Extra
a	int(11)	YES		NULL	
deallocate prepare s_6895;
drop table t1;
create table t1 (i int primary key auto_increment) comment='comment for table t1';
create table t2 (i int, j int, k int);
prepare stmt from "alter table t1 auto_increment=100";
execute stmt;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `i` int(11) NOT NULL auto_increment,
  PRIMARY KEY  (`i`)
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1'
flush tables;
select * from t2;
i	j	k
execute stmt;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `i` int(11) NOT NULL auto_increment,
  PRIMARY KEY  (`i`)
) ENGINE=MyISAM AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 COMMENT='comment for table t1'
deallocate prepare stmt;
drop table t1, t2;
End of 5.0 tests.
+17 −0
Original line number Diff line number Diff line
@@ -5626,6 +5626,23 @@ Called B
Called B
drop procedure proc_21462_a|
drop procedure proc_21462_b|
drop table if exists t3|
drop procedure if exists proc_bug19733|
create table t3 (s1 int)|
create procedure proc_bug19733()
begin
declare v int default 0;
while v < 100 do
create index i on t3 (s1);
drop index i on t3;
set v = v + 1;
end while;
end|
call proc_bug19733()|
call proc_bug19733()|
call proc_bug19733()|
drop procedure proc_bug19733|
drop table t3|
End of 5.0 tests
DROP TABLE IF EXISTS bug23760|
DROP TABLE IF EXISTS bug23760_log|
+142 −1
Original line number Diff line number Diff line
@@ -1106,10 +1106,80 @@ EXECUTE stmt USING @a;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;

#
# Bug#19182: CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work
# from stored procedure.
#
# The cause of a bug was that cached LEX::create_list was modified,
# and then together with LEX::key_list was reset.
#
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings

--echo End of 4.1 tests.
CREATE TABLE t1 (i INT);

PREPARE st_19182
FROM "CREATE TABLE t2 (i INT, j INT, KEY (i), KEY(j)) SELECT i FROM t1";

EXECUTE st_19182;
DESC t2;

DROP TABLE t2;

# Check that on second execution we don't loose 'j' column and the keys
# on 'i' and 'j' columns.
EXECUTE st_19182;
DESC t2;

DEALLOCATE PREPARE st_19182;
DROP TABLE t2, t1;

#
# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
#
# Code which implemented CREATE/ALTER TABLE and CREATE DATABASE
# statement modified HA_CREATE_INFO structure in LEX, making these
# statements PS/SP-unsafe (their re-execution might have resulted
# in incorrect results).
#
--disable_warnings
drop database if exists mysqltest;
drop table if exists t1, t2;
--enable_warnings
# CREATE TABLE and CREATE TABLE ... SELECT
create database mysqltest character set utf8;
prepare stmt1 from "create table mysqltest.t1 (c char(10))";
prepare stmt2 from "create table mysqltest.t2 select 'test'";
execute stmt1;
execute stmt2;
show create table mysqltest.t1;
show create table mysqltest.t2;
drop table mysqltest.t1;
drop table mysqltest.t2;
alter database mysqltest character set latin1;
execute stmt1;
execute stmt2;
show create table mysqltest.t1;
show create table mysqltest.t2;
drop database mysqltest;
deallocate prepare stmt1;
deallocate prepare stmt2;
# CREATE TABLE with DATA DIRECTORY option
--disable_query_log
eval prepare stmt from "create table t1 (c char(10)) data directory='$MYSQLTEST_VARDIR/tmp'";
--enable_query_log
execute stmt;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;
drop table t1;
execute stmt;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;
drop table t1;
deallocate prepare stmt;

--echo End of 4.1 tests.

############################# 5.0 tests start ################################
#
@@ -1585,5 +1655,76 @@ EXECUTE stmt USING @arg;
DEALLOCATE PREPARE stmt;

DROP TABLE t1,t2;
#
# Bug#4968 "Stored procedure crash if cursor opened on altered table"
# The bug is not repeatable any more after the fix for
# Bug#15217 "Bug #15217   Using a SP cursor on a table created with PREPARE
# fails with weird error", however ALTER TABLE is not re-execution friendly
# and that caused a valgrind warning. Check that the warning is gone.
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (s1 char(20));
prepare stmt from "alter table t1 modify s1 int";
execute stmt;
execute stmt;
drop table t1;
deallocate prepare stmt;

#
# Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int, b int);
prepare s_6895 from "alter table t1 drop column b";
execute s_6895;
show columns from t1;
drop table t1;
create table t1 (a int, b int);
execute s_6895;
show columns from t1;
drop table t1;
create table t1 (a int, b int);
execute s_6895;
show columns from t1;
deallocate prepare s_6895;
drop table t1;

#
# Bug #22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"
#
# 5.0 part of the test.
#

# ALTER TABLE
create table t1 (i int primary key auto_increment) comment='comment for table t1';
create table t2 (i int, j int, k int);
prepare stmt from "alter table t1 auto_increment=100";
execute stmt;
show create table t1;
# Let us trash table-cache's memory
flush tables;
select * from t2;
execute stmt;
show create table t1;
deallocate prepare stmt;
drop table t1, t2;
# 5.1 part of the test.
# CREATE DATABASE
#set @old_character_set_server= @@character_set_server;
#set @@character_set_server= latin1; 
#prepare stmt from "create database mysqltest";
#execute stmt;
#show create database mysqltest;
#drop database mysqltest;
#set @@character_set_server= utf8; 
#execute stmt;
#show create database mysqltest;
#drop database mysqltest;
#deallocate prepare stmt;
#set @@character_set_server= @old_character_set_server;

--echo End of 5.0 tests.
+28 −0
Original line number Diff line number Diff line
@@ -6587,6 +6587,34 @@ call proc_21462_b(1)|
drop procedure proc_21462_a|
drop procedure proc_21462_b|


#
# Bug#19733 "Repeated alter, or repeated create/drop, fails"
# Check that CREATE/DROP INDEX is re-execution friendly.
# 
--disable_warnings
drop table if exists t3|
drop procedure if exists proc_bug19733|
--enable_warnings
create table t3 (s1 int)|

create procedure proc_bug19733()
begin
  declare v int default 0;
  while v < 100 do
    create index i on t3 (s1);
    drop index i on t3;
    set v = v + 1;
  end while;
end|

call proc_bug19733()|
call proc_bug19733()|
call proc_bug19733()|

drop procedure proc_bug19733|
drop table t3|

--echo End of 5.0 tests


+6 −10
Original line number Diff line number Diff line
@@ -773,17 +773,15 @@ int prepare_create_field(create_field *sql_field,
			 uint table_flags);
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
                        HA_CREATE_INFO *create_info,
                        List<create_field> &fields, List<Key> &keys,
                        Alter_info *alter_info,
                        bool tmp_table, uint select_field_count);

bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
                       HA_CREATE_INFO *create_info,
                       TABLE_LIST *table_list,
                       List<create_field> &fields,
                       List<Key> &keys,
                       uint order_num, ORDER *order, bool ignore,
                       ALTER_INFO *alter_info, bool do_send_ok);
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok);
                       Alter_info *alter_info,
                       uint order_num, ORDER *order, bool ignore);
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list);
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
                             HA_CREATE_INFO *create_info,
                             Table_ident *src_table);
@@ -792,9 +790,6 @@ bool mysql_rename_table(enum db_type base,
			const char * old_name,
			const char *new_db,
			const char * new_name);
bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
bool mysql_drop_index(THD *thd, TABLE_LIST *table_list,
                      ALTER_INFO *alter_info);
bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
                          Item **conds, uint order_num, ORDER *order);
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
@@ -896,7 +891,8 @@ int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
bool mysqld_show_create_db(THD *thd, char *dbname,
                           const HA_CREATE_INFO *create);

void mysqld_list_processes(THD *thd,const char *user,bool verbose);
int mysqld_show_status(THD *thd);
Loading