Commit cae189b1 authored by unknown's avatar unknown

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

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


mysql-test/t/multi_update.test:
  Auto merged
parents a8341f1b c8cfe3d2
...@@ -538,7 +538,6 @@ static void free_used_memory() ...@@ -538,7 +538,6 @@ static void free_used_memory()
mysql_server_end(); mysql_server_end();
if (ps_protocol) if (ps_protocol)
ps_free_reg(); ps_free_reg();
my_end(MY_CHECK_ERROR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -556,6 +555,7 @@ static void die(const char* fmt, ...) ...@@ -556,6 +555,7 @@ static void die(const char* fmt, ...)
} }
va_end(args); va_end(args);
free_used_memory(); free_used_memory();
my_end(MY_CHECK_ERROR);
exit(1); exit(1);
} }
...@@ -568,6 +568,7 @@ static void abort_not_supported_test() ...@@ -568,6 +568,7 @@ static void abort_not_supported_test()
if (!silent) if (!silent)
printf("skipped\n"); printf("skipped\n");
free_used_memory(); free_used_memory();
my_end(MY_CHECK_ERROR);
exit(2); exit(2);
} }
...@@ -3655,6 +3656,7 @@ int main(int argc, char **argv) ...@@ -3655,6 +3656,7 @@ int main(int argc, char **argv)
if (!got_end_timer) if (!got_end_timer)
timer_output(); /* No end_timer cmd, end it */ timer_output(); /* No end_timer cmd, end it */
free_used_memory(); free_used_memory();
my_end(MY_CHECK_ERROR);
exit(error ? 1 : 0); exit(error ? 1 : 0);
return error ? 1 : 0; /* Keep compiler happy */ return error ? 1 : 0; /* Keep compiler happy */
} }
......
This diff is collapsed.
...@@ -14,6 +14,7 @@ sub mtr_report_test_skipped($); ...@@ -14,6 +14,7 @@ sub mtr_report_test_skipped($);
sub mtr_show_failed_diff ($); sub mtr_show_failed_diff ($);
sub mtr_report_stats ($); sub mtr_report_stats ($);
sub mtr_print_line (); sub mtr_print_line ();
sub mtr_print_thick_line ();
sub mtr_print_header (); sub mtr_print_header ();
sub mtr_report (@); sub mtr_report (@);
sub mtr_warning (@); sub mtr_warning (@);
...@@ -214,6 +215,10 @@ sub mtr_print_line () { ...@@ -214,6 +215,10 @@ sub mtr_print_line () {
print '-' x 55, "\n"; print '-' x 55, "\n";
} }
sub mtr_print_thick_line () {
print '=' x 55, "\n";
}
sub mtr_print_header () { sub mtr_print_header () {
print "\n"; print "\n";
if ( $::opt_timer ) if ( $::opt_timer )
...@@ -250,7 +255,7 @@ sub mtr_error (@) { ...@@ -250,7 +255,7 @@ sub mtr_error (@) {
sub mtr_debug (@) { sub mtr_debug (@) {
if ( $::opt_script_debug ) if ( $::opt_script_debug )
{ {
print "mysql-test-run: DEBUG: ",join(" ", @_),"\n"; print STDERR "####: ",join(" ", @_),"\n";
} }
} }
......
This diff is collapsed.
...@@ -121,7 +121,7 @@ create database mysqltest; ...@@ -121,7 +121,7 @@ create database mysqltest;
create table mysqltest.t1 (a int,b int,c int); create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost; grant all on mysqltest.t1 to mysqltest_1@localhost;
alter table t1 rename t2; alter table t1 rename t2;
ERROR 42000: insert command denied to user 'mysqltest_1'@'localhost' for table 't2' ERROR 42000: INSERT,CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2'
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1'; delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest; drop database mysqltest;
......
...@@ -37,7 +37,6 @@ show grants for current_user(); ...@@ -37,7 +37,6 @@ show grants for current_user();
Grants for mysqltest_1@localhost Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost' GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
use mysqltest;
insert into t1 values (1, 'I can''t change it!'); insert into t1 values (1, 'I can''t change it!');
update t1 set data='I can change it!' where id = 1; update t1 set data='I can change it!' where id = 1;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest' ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
...@@ -47,8 +46,20 @@ select * from t1; ...@@ -47,8 +46,20 @@ select * from t1;
id data id data
1 I can't change it! 1 I can't change it!
drop table t1; drop table t1;
drop database mysqltest;
use test;
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
flush privileges; flush privileges;
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
grant select (a,b) on t1 to mysqltest_2@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
grant select on t1 to mysqltest_3@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
drop database mysqltest;
use test;
...@@ -134,7 +134,7 @@ a b c a ...@@ -134,7 +134,7 @@ a b c a
1 1 1 test.t1 1 1 1 test.t1
2 2 2 test.t1 2 2 2 test.t1
select * from t2; select * from t2;
ERROR 42000: select command denied to user 'mysqltest_2'@'localhost' for table 't2' ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 6 Qcache_queries_in_cache 6
...@@ -148,7 +148,7 @@ select "user3"; ...@@ -148,7 +148,7 @@ select "user3";
user3 user3
user3 user3
select * from t1; select * from t1;
ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1' ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
select a from t1; select a from t1;
a a
1 1
...@@ -156,7 +156,7 @@ a ...@@ -156,7 +156,7 @@ a
select c from t1; select c from t1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1' ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
select * from t2; select * from t2;
ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for table 't2' ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't2'
select mysqltest.t1.c from test.t1,mysqltest.t1; select mysqltest.t1.c from test.t1,mysqltest.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1' ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
......
...@@ -834,7 +834,7 @@ execute s_t9 ; ...@@ -834,7 +834,7 @@ execute s_t9 ;
my_col my_col
1 1
select a as my_col from t1; select a as my_col from t1;
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1' ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
grant select on mysqltest.t1 to second_user@localhost grant select on mysqltest.t1 to second_user@localhost
identified by 'looser' ; identified by 'looser' ;
show grants for second_user@localhost ; show grants for second_user@localhost ;
...@@ -873,7 +873,7 @@ Grants for second_user@localhost ...@@ -873,7 +873,7 @@ Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3' GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost' GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
execute s_t1 ; execute s_t1 ;
ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1' ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
revoke all privileges, grant option from second_user@localhost ; revoke all privileges, grant option from second_user@localhost ;
show grants for second_user@localhost ; show grants for second_user@localhost ;
Grants for second_user@localhost Grants for second_user@localhost
......
...@@ -295,9 +295,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC') ...@@ -295,9 +295,9 @@ convert_tz(b, 'Europe/Moscow', 'UTC')
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC') update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2); where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name; select * from mysql.time_zone_name;
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name; select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: select command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name' ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%';
......
...@@ -115,13 +115,13 @@ set global concurrent_insert=DEFAULT; ...@@ -115,13 +115,13 @@ set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
Variable_name Value Variable_name Value
concurrent_insert ON concurrent_insert ON
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB"; set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
show local variables like 'storage_engine'; show local variables like 'storage_engine';
Variable_name Value Variable_name Value
storage_engine HEAP storage_engine HEAP
show global variables like 'storage_engine'; show global variables like 'storage_engine';
Variable_name Value Variable_name Value
storage_engine InnoDB storage_engine MERGE
set GLOBAL query_cache_size=100000; set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000; set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
...@@ -220,7 +220,7 @@ set max_join_size="hello"; ...@@ -220,7 +220,7 @@ set max_join_size="hello";
ERROR 42000: Incorrect argument type to variable 'max_join_size' ERROR 42000: Incorrect argument type to variable 'max_join_size'
set storage_engine=UNKNOWN_TABLE_TYPE; set storage_engine=UNKNOWN_TABLE_TYPE;
ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE' ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
set storage_engine=INNODB, big_tables=2; set storage_engine=MERGE, big_tables=2;
ERROR 42000: Variable 'big_tables' can't be set to the value of '2' ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
show local variables like 'storage_engine'; show local variables like 'storage_engine';
Variable_name Value Variable_name Value
......
...@@ -50,10 +50,9 @@ flush privileges; ...@@ -50,10 +50,9 @@ flush privileges;
use mysqltest; use mysqltest;
create table t1 (id int primary key, data varchar(255)); create table t1 (id int primary key, data varchar(255));
connect (mrbad, localhost, mysqltest_1,,); connect (mrbad, localhost, mysqltest_1,,mysqltest);
connection mrbad; connection mrbad;
show grants for current_user(); show grants for current_user();
use mysqltest;
insert into t1 values (1, 'I can''t change it!'); insert into t1 values (1, 'I can''t change it!');
--error 1044 --error 1044
update t1 set data='I can change it!' where id = 1; update t1 set data='I can change it!' where id = 1;
...@@ -61,11 +60,32 @@ update t1 set data='I can change it!' where id = 1; ...@@ -61,11 +60,32 @@ update t1 set data='I can change it!' where id = 1;
--error 1044 --error 1044
insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!'; insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
select * from t1; select * from t1;
disconnect mrbad;
connection default;
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
connect (mrugly, localhost, mysqltest_1,,mysqltest);
connection mrugly;
--error 1143
grant select (a,b) on t1 to mysqltest_2@localhost;
--error 1142
grant select on t1 to mysqltest_3@localhost;
disconnect mrugly;
connection default; connection default;
drop table t1; drop table t1;
drop database mysqltest;
use test;
delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges; flush privileges;
drop database mysqltest;
use test;
...@@ -433,6 +433,7 @@ delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2 ...@@ -433,6 +433,7 @@ delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2
drop table t1,t2; drop table t1,t2;
# Test for BUG#5837 - delete with outer join and const tables # Test for BUG#5837 - delete with outer join and const tables
--disable_warnings
create table t1 ( create table t1 (
aclid bigint not null primary key, aclid bigint not null primary key,
status tinyint(1) not null status tinyint(1) not null
...@@ -442,6 +443,7 @@ create table t2 ( ...@@ -442,6 +443,7 @@ create table t2 (
refid bigint not null primary key, refid bigint not null primary key,
aclid bigint, index idx_acl(aclid) aclid bigint, index idx_acl(aclid)
) engine = innodb; ) engine = innodb;
--enable_warnings
insert into t2 values(1,null); insert into t2 values(1,null);
delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1'; delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2; drop table t1, t2;
......
...@@ -71,7 +71,7 @@ show variables like 'concurrent_insert'; ...@@ -71,7 +71,7 @@ show variables like 'concurrent_insert';
set global concurrent_insert=DEFAULT; set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert'; show variables like 'concurrent_insert';
set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB"; set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
show local variables like 'storage_engine'; show local variables like 'storage_engine';
show global variables like 'storage_engine'; show global variables like 'storage_engine';
set GLOBAL query_cache_size=100000; set GLOBAL query_cache_size=100000;
...@@ -128,7 +128,7 @@ set max_join_size="hello"; ...@@ -128,7 +128,7 @@ set max_join_size="hello";
--error 1286 --error 1286
set storage_engine=UNKNOWN_TABLE_TYPE; set storage_engine=UNKNOWN_TABLE_TYPE;
--error 1231 --error 1231
set storage_engine=INNODB, big_tables=2; set storage_engine=MERGE, big_tables=2;
show local variables like 'storage_engine'; show local variables like 'storage_engine';
--error 1229 --error 1229
set SESSION query_cache_size=10000; set SESSION query_cache_size=10000;
......
...@@ -964,9 +964,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db, ...@@ -964,9 +964,8 @@ static void acl_insert_db(const char *user, const char *host, const char *db,
ulong acl_get(const char *host, const char *ip, ulong acl_get(const char *host, const char *ip,
const char *user, const char *db, my_bool db_is_pattern) const char *user, const char *db, my_bool db_is_pattern)
{ {
ulong host_access,db_access; ulong host_access= ~0,db_access= 0;
uint i,key_length; uint i,key_length;
db_access=0; host_access= ~0;
char key[ACL_KEY_LENGTH],*tmp_db,*end; char key[ACL_KEY_LENGTH],*tmp_db,*end;
acl_entry *entry; acl_entry *entry;
DBUG_ENTER("acl_get"); DBUG_ENTER("acl_get");
...@@ -2256,6 +2255,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, ...@@ -2256,6 +2255,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (!revoke_grant)
{
if (columns.elements && !revoke_grant) if (columns.elements && !revoke_grant)
{ {
TABLE *table; TABLE *table;
...@@ -2267,19 +2268,25 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, ...@@ -2267,19 +2268,25 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
while ((column = column_iter++)) while ((column = column_iter++))
{ {
uint unused_field_idx= NO_CACHED_FIELD_INDEX; uint unused_field_idx= NO_CACHED_FIELD_INDEX;
if (!find_field_in_table(thd,table,column->column.ptr(), Field *f= find_field_in_table(thd,table,column->column.ptr(),
column->column.length(),0,0, column->column.length(),1,0,&unused_field_idx);
&unused_field_idx)) if (!f)
{ {
my_error(ER_BAD_FIELD_ERROR, MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0),
column->column.c_ptr(), table_list->alias); column->column.c_ptr(), table_list->alias);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if (f == (Field*)-1)
{
DBUG_RETURN(-1);
}
column_priv|= column->rights; column_priv|= column->rights;
} }
close_thread_tables(thd); close_thread_tables(thd);
} }
else if (!(rights & CREATE_ACL) && !revoke_grant) else
{
if (!(rights & CREATE_ACL))
{ {
char buf[FN_REFLEN]; char buf[FN_REFLEN];
sprintf(buf,"%s/%s/%s.frm",mysql_data_home, table_list->db, sprintf(buf,"%s/%s/%s.frm",mysql_data_home, table_list->db,
...@@ -2291,6 +2298,17 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, ...@@ -2291,6 +2298,17 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
} }
if (table_list->grant.want_privilege)
{
char command[128];
get_privilege_desc(command, sizeof(command),
table_list->grant.want_privilege);
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
command, thd->priv_user, thd->host_or_ip, table_list->alias);
DBUG_RETURN(-1);
}
}
}
/* open the mysql.tables_priv and mysql.columns_priv tables */ /* open the mysql.tables_priv and mysql.columns_priv tables */
...@@ -2773,25 +2791,8 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, ...@@ -2773,25 +2791,8 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
rw_unlock(&LOCK_grant); rw_unlock(&LOCK_grant);
if (!no_errors) // Not a silent skip of table if (!no_errors) // Not a silent skip of table
{ {
const char *command=""; char command[128];
if (want_access & SELECT_ACL) get_privilege_desc(command, sizeof(command), want_access);
command= "select";
else if (want_access & INSERT_ACL)
command= "insert";
else if (want_access & UPDATE_ACL)
command= "update";
else if (want_access & DELETE_ACL)
command= "delete";
else if (want_access & DROP_ACL)
command= "drop";
else if (want_access & CREATE_ACL)
command= "create";
else if (want_access & ALTER_ACL)
command= "alter";
else if (want_access & INDEX_ACL)
command= "index";
else if (want_access & GRANT_ACL)
command= "grant";
net_printf(thd,ER_TABLEACCESS_DENIED_ERROR, net_printf(thd,ER_TABLEACCESS_DENIED_ERROR,
command, command,
thd->priv_user, thd->priv_user,
...@@ -2906,11 +2907,8 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table) ...@@ -2906,11 +2907,8 @@ bool check_grant_all_columns(THD *thd, ulong want_access, TABLE *table)
err: err:
rw_unlock(&LOCK_grant); rw_unlock(&LOCK_grant);
err2: err2:
const char *command= ""; char command[128];
if (want_access & SELECT_ACL) get_privilege_desc(command, sizeof(command), want_access);
command= "select";
else if (want_access & INSERT_ACL)
command= "insert";
my_printf_error(ER_COLUMNACCESS_DENIED_ERROR, my_printf_error(ER_COLUMNACCESS_DENIED_ERROR,
ER(ER_COLUMNACCESS_DENIED_ERROR), ER(ER_COLUMNACCESS_DENIED_ERROR),
MYF(0), MYF(0),
......
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