Commit 79926634 authored by unknown's avatar unknown

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

into mysql.com:/home/my/mysql-4.1


sql/sql_table.cc:
  Auto merged
parents 6a868cca f4638489
-- require r/have_debug.require
disable_query_log;
select instr(version(),convert('debug' using utf8))!=0;
enable_query_log;
instr(version(),convert('debug' using utf8))!=0
1
CREATE TABLE t1 (a int);
CREATE TABLE t2 LIKE t1;
ALTER TABLE t1 add key(a);
CREATE TABLE t1 (x1 int);
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) default NULL
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
CREATE TABLE t1 (a int);
CREATE TABLE t2 LIKE t1;
CREATE TABLE t2 (b int);
let's take a look at result of create .. like :
-----------
ERROR HY000: Can't create/write to file './test/t2.frm' (Errcode: 17)
-----------
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`b` int(11) default NULL
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
DROP TABLE t1;
--exit-info=2048
\ No newline at end of file
-- source include/have_debug.inc
#
# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table
#
connect (con_to_sleep,localhost,lock_controller,,);
connect (con_to_harm_sleeper,localhost,root,,);
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
# locking of source:
connection con_to_sleep;
CREATE TABLE t1 (a int);
send CREATE TABLE t2 LIKE t1;
connection con_to_harm_sleeper;
sleep 1;
ALTER TABLE t1 add key(a);
connection con_to_sleep;
sleep 4;
SHOW CREATE TABLE t2;
drop table t1, t2;
# locking of destination:
connection con_to_sleep;
CREATE TABLE t1 (a int);
send CREATE TABLE t2 LIKE t1;
connection con_to_harm_sleeper;
sleep 1;
CREATE TABLE t2 (b int);
disable_query_log;
select "-----------" as "let's take a look at result of create .. like : ";
enable_query_log;
connection con_to_sleep;
sleep 1;
--error 1
reap;
disable_query_log;
select "" as "-----------";
enable_query_log;
SHOW CREATE TABLE t2;
drop table t1, t2;
\ No newline at end of file
CREATE TABLE t1 (x1 int);
let $1= 10;
while ($1)
{
connection con1;
send ALTER TABLE t1 CHANGE x1 x2 int;
connection con2;
CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx;
SHOW CREATE TABLE t2;
DROP TABLE t2;
connection con1;
reap;
send ALTER TABLE t1 CHANGE x2 x1 int;
connection con2;
CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx;
SHOW CREATE TABLE t2;
DROP TABLE t2;
connection con1;
reap;
dec $1;
}
DROP TABLE t1;
......@@ -802,7 +802,7 @@ static int mysql_test_select_fields(Prepared_statement *stmt,
if (check_table_access(thd, privilege, tables,0))
DBUG_RETURN(1);
}
else if (check_access(thd, privilege, "*any*",0,0,0))
else if (check_access(thd, privilege, any_db,0,0,0))
DBUG_RETURN(1);
#endif
if ((&lex->select_lex != lex->all_selects_list &&
......
......@@ -1963,11 +1963,6 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
/*
Create a new table by copying from source table
*/
#ifndef DBUG_OFF
// The code stated below is for test synchronization.test Bug #2385
if (test_flags & TEST_SYNCHRONIZATION)
sleep(3);
#endif
if (my_copy(src_path, dst_path, MYF(MY_WME|MY_DONT_OVERWRITE_FILE)))
goto err;
......
......@@ -722,7 +722,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
union_clause union_list
precision subselect_start opt_and charset
subselect_end select_var_list select_var_list_init help opt_len
opt_extended_describe curr_user
opt_extended_describe
END_OF_INPUT
%type <NONE>
......@@ -2685,7 +2685,7 @@ simple_expr:
$$= new Item_func_curtime_local($3);
Lex->safe_to_cache_query=0;
}
| curr_user
| CURRENT_USER optional_braces
{ $$= create_func_current_user(); }
| DATE_ADD_INTERVAL '(' expr ',' interval_expr interval ')'
{ $$= new Item_date_add_interval($3,$5,$6,0); }
......@@ -4769,11 +4769,6 @@ ident_or_text:
| TEXT_STRING_sys { $$=$1;}
| LEX_HOSTNAME { $$=$1;};
curr_user:
CURRENT_USER {;}
| CURRENT_USER '(' ')' {;}
;
user:
ident_or_text
{
......@@ -4791,7 +4786,7 @@ user:
YYABORT;
$$->user = $1; $$->host=$3;
}
| curr_user
| CURRENT_USER optional_braces
{
THD *thd= YYTHD;
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
......@@ -4846,7 +4841,6 @@ keyword:
| COMPRESSED_SYM {}
| CONCURRENT {}
| CUBE_SYM {}
| CURRENT_USER {}
| DATA_SYM {}
| DATETIME {}
| DATE_SYM {}
......
......@@ -1288,7 +1288,7 @@ bool check_db_name(char *name)
/* Used to catch empty names and names with end space */
bool last_char_is_space= TRUE;
if (lower_case_table_names)
if (lower_case_table_names && name != any_db)
my_casedn_str(files_charset_info, name);
while (*name)
......
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