Merge bk-internal.mysql.com:/home/bk/mysql-5.0-marvel
into sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.0
This commit is contained in:
commit
237ed0c3e5
@ -51,5 +51,5 @@ enum options_client
|
|||||||
OPT_TRIGGERS,
|
OPT_TRIGGERS,
|
||||||
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
|
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
|
||||||
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_SSL_VERIFY_SERVER_CERT,
|
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_SSL_VERIFY_SERVER_CERT,
|
||||||
OPT_DEBUG_INFO
|
OPT_DEBUG_INFO, OPT_ERROR_LOG_FILE
|
||||||
};
|
};
|
||||||
|
@ -105,7 +105,8 @@ static char *opt_password=0,*current_user=0,
|
|||||||
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
|
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
|
||||||
*where=0, *order_by=0,
|
*where=0, *order_by=0,
|
||||||
*opt_compatible_mode_str= 0,
|
*opt_compatible_mode_str= 0,
|
||||||
*err_ptr= 0;
|
*err_ptr= 0,
|
||||||
|
*log_error_file= NULL;
|
||||||
static char **defaults_argv= 0;
|
static char **defaults_argv= 0;
|
||||||
static char compatible_mode_normal_str[255];
|
static char compatible_mode_normal_str[255];
|
||||||
static ulong opt_compatible_mode= 0;
|
static ulong opt_compatible_mode= 0;
|
||||||
@ -116,7 +117,9 @@ static my_string opt_mysql_unix_port=0;
|
|||||||
static int first_error=0;
|
static int first_error=0;
|
||||||
static DYNAMIC_STRING extended_row;
|
static DYNAMIC_STRING extended_row;
|
||||||
#include <sslopt-vars.h>
|
#include <sslopt-vars.h>
|
||||||
FILE *md_result_file= 0;
|
FILE *md_result_file= 0;
|
||||||
|
FILE *stderror_file=0;
|
||||||
|
|
||||||
#ifdef HAVE_SMEM
|
#ifdef HAVE_SMEM
|
||||||
static char *shared_memory_base_name=0;
|
static char *shared_memory_base_name=0;
|
||||||
#endif
|
#endif
|
||||||
@ -293,6 +296,9 @@ static struct my_option my_long_options[] =
|
|||||||
0, 0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0, 0},
|
||||||
{"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
|
{"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables,
|
||||||
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
|
||||||
|
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
|
||||||
|
(gptr*) &log_error_file, (gptr*) &log_error_file, 0, GET_STR,
|
||||||
|
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"master-data", OPT_MASTER_DATA,
|
{"master-data", OPT_MASTER_DATA,
|
||||||
"This causes the binary log position and filename to be appended to the "
|
"This causes the binary log position and filename to be appended to the "
|
||||||
"output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
|
"output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
|
||||||
@ -3694,6 +3700,16 @@ int main(int argc, char **argv)
|
|||||||
free_resources(0);
|
free_resources(0);
|
||||||
exit(exit_code);
|
exit(exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (log_error_file)
|
||||||
|
{
|
||||||
|
if(!(stderror_file= freopen(log_error_file, "a+", stderr)))
|
||||||
|
{
|
||||||
|
free_resources(0);
|
||||||
|
exit(EX_MYSQLERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (connect_to_db(current_host, current_user, opt_password))
|
if (connect_to_db(current_host, current_user, opt_password))
|
||||||
{
|
{
|
||||||
free_resources(0);
|
free_resources(0);
|
||||||
@ -3746,5 +3762,9 @@ err:
|
|||||||
if (!path)
|
if (!path)
|
||||||
write_footer(md_result_file);
|
write_footer(md_result_file);
|
||||||
free_resources();
|
free_resources();
|
||||||
|
|
||||||
|
if (stderror_file)
|
||||||
|
fclose(stderror_file);
|
||||||
|
|
||||||
return(first_error);
|
return(first_error);
|
||||||
} /* main */
|
} /* main */
|
||||||
|
@ -106,16 +106,82 @@ use testdb_1;
|
|||||||
create table t1 (f1 char(4));
|
create table t1 (f1 char(4));
|
||||||
create view v1 as select f1 from t1;
|
create view v1 as select f1 from t1;
|
||||||
grant insert on v1 to testdb_2@localhost;
|
grant insert on v1 to testdb_2@localhost;
|
||||||
|
create view v5 as select f1 from t1;
|
||||||
|
grant show view on v5 to testdb_2@localhost;
|
||||||
|
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
|
||||||
|
ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||||
|
use testdb_1;
|
||||||
|
create view v6 as select f1 from t1;
|
||||||
|
grant show view on v6 to testdb_2@localhost;
|
||||||
|
create table t2 (f1 char(4));
|
||||||
|
create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
|
||||||
|
Warnings:
|
||||||
|
Note 1449 There is no 'no_such_user'@'no_such_host' registered
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 char(4) YES NULL
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
View Create View
|
||||||
|
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select `t1`.`f1` AS `f1` from `t1`
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
View Create View
|
||||||
|
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
|
||||||
|
Warnings:
|
||||||
|
Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 null YES NULL
|
||||||
|
Warnings:
|
||||||
|
Note 1449 There is no 'no_such_user'@'no_such_host' registered
|
||||||
create table t3 (f1 char(4), f2 char(4));
|
create table t3 (f1 char(4), f2 char(4));
|
||||||
create view v3 as select f1,f2 from t3;
|
create view v3 as select f1,f2 from t3;
|
||||||
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
||||||
create view v2 as select f1 from testdb_1.v1;
|
create view v2 as select f1 from testdb_1.v1;
|
||||||
create view v4 as select f1,f2 from testdb_1.v3;
|
create view v4 as select f1,f2 from testdb_1.v3;
|
||||||
|
show fields from testdb_1.v5;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 char(4) YES NULL
|
||||||
|
show create view testdb_1.v5;
|
||||||
|
View Create View
|
||||||
|
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 char(4) YES NULL
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
View Create View
|
||||||
|
v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1`
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
Field Type Null Key Default Extra
|
||||||
|
f1 null YES NULL
|
||||||
|
Warnings:
|
||||||
|
Note 1449 There is no 'no_such_user'@'no_such_host' registered
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
View Create View
|
||||||
|
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2`
|
||||||
|
Warnings:
|
||||||
|
Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
revoke insert(f1) on v3 from testdb_2@localhost;
|
revoke insert(f1) on v3 from testdb_2@localhost;
|
||||||
|
revoke show view on v5 from testdb_2@localhost;
|
||||||
|
use testdb_1;
|
||||||
|
revoke show view on v6 from testdb_2@localhost;
|
||||||
|
show fields from testdb_1.v5;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
|
||||||
|
show create view testdb_1.v5;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v5'
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6'
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v6'
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
ERROR 42000: SELECT command denied to user 'testdb_2'@'localhost' for table 'v7'
|
||||||
show create view v4;
|
show create view v4;
|
||||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
||||||
show fields from v4;
|
show fields from v4;
|
||||||
ERROR HY000: EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
|
Field Type Null Key Default Extra
|
||||||
|
f1 null YES NULL
|
||||||
|
f2 char(4) YES NULL
|
||||||
show fields from v2;
|
show fields from v2;
|
||||||
Field Type Null Key Default Extra
|
Field Type Null Key Default Extra
|
||||||
f1 char(4) YES NULL
|
f1 char(4) YES NULL
|
||||||
@ -140,7 +206,8 @@ where a.table_name = 'testdb_1.v1';
|
|||||||
view_definition
|
view_definition
|
||||||
select * from v2;
|
select * from v2;
|
||||||
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||||
drop view testdb_1.v1,v2, testdb_1.v3, v4;
|
use test;
|
||||||
|
drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
||||||
drop database testdb_1;
|
drop database testdb_1;
|
||||||
drop user testdb_1@localhost;
|
drop user testdb_1@localhost;
|
||||||
drop user testdb_2@localhost;
|
drop user testdb_2@localhost;
|
||||||
|
@ -5970,3 +5970,28 @@ SUM(f2) bug25373(f1)
|
|||||||
DROP FUNCTION bug25373|
|
DROP FUNCTION bug25373|
|
||||||
DROP TABLE t3|
|
DROP TABLE t3|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
|
||||||
|
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
|
||||||
|
set @a=0;
|
||||||
|
CREATE function bug27354() RETURNS int deterministic
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
set @a=@a+1;
|
||||||
|
return @a;
|
||||||
|
end|
|
||||||
|
update t2 set b=1 where a=bug27354();
|
||||||
|
select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
|
||||||
|
count(t_1.a) count(t_2.a)
|
||||||
|
0 0
|
||||||
|
insert into t2 values (1,1),(2,2),(3,3);
|
||||||
|
update t2 set b=-b where a=bug27354();
|
||||||
|
select * from t2 /* must return 1,-1 ... */;
|
||||||
|
a b
|
||||||
|
1 -1
|
||||||
|
2 -2
|
||||||
|
3 -3
|
||||||
|
select count(*) from t1 /* must be 3 */;
|
||||||
|
count(*)
|
||||||
|
3
|
||||||
|
drop table t1,t2;
|
||||||
|
drop function bug27354;
|
||||||
|
@ -530,3 +530,34 @@ count(*)
|
|||||||
drop table t3, t4|
|
drop table t3, t4|
|
||||||
drop procedure bug14210|
|
drop procedure bug14210|
|
||||||
set @@session.max_heap_table_size=default|
|
set @@session.max_heap_table_size=default|
|
||||||
|
drop function if exists bug23333|
|
||||||
|
drop table if exists t1,t2|
|
||||||
|
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
|
||||||
|
CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
|
||||||
|
reset master|
|
||||||
|
insert into t2 values (1,1)|
|
||||||
|
create function bug23333()
|
||||||
|
RETURNS int(11)
|
||||||
|
DETERMINISTIC
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
select count(*) from t1 into @a;
|
||||||
|
return @a;
|
||||||
|
end|
|
||||||
|
insert into t2 values (bug23333(),1)|
|
||||||
|
ERROR 23000: Duplicate entry '1' for key 1
|
||||||
|
show binlog events from 98 /* must show the insert */|
|
||||||
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query 1 # use `test`; insert into t2 values (1,1)
|
||||||
|
master-bin.000001 # Xid 1 # COMMIT /* xid=1165 */
|
||||||
|
master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` function bug23333()
|
||||||
|
RETURNS int(11)
|
||||||
|
DETERMINISTIC
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
select count(*) from t1 into @a;
|
||||||
|
return @a;
|
||||||
|
end
|
||||||
|
select count(*),@a from t1 /* must be 1,1 */|
|
||||||
|
count(*) @a
|
||||||
|
1 1
|
||||||
|
@ -121,6 +121,28 @@ create table t1 (f1 char(4));
|
|||||||
create view v1 as select f1 from t1;
|
create view v1 as select f1 from t1;
|
||||||
grant insert on v1 to testdb_2@localhost;
|
grant insert on v1 to testdb_2@localhost;
|
||||||
|
|
||||||
|
create view v5 as select f1 from t1;
|
||||||
|
grant show view on v5 to testdb_2@localhost;
|
||||||
|
|
||||||
|
--error 1227
|
||||||
|
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
use testdb_1;
|
||||||
|
create view v6 as select f1 from t1;
|
||||||
|
grant show view on v6 to testdb_2@localhost;
|
||||||
|
|
||||||
|
create table t2 (f1 char(4));
|
||||||
|
create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
|
||||||
|
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
|
||||||
|
connection testdb_1;
|
||||||
|
|
||||||
create table t3 (f1 char(4), f2 char(4));
|
create table t3 (f1 char(4), f2 char(4));
|
||||||
create view v3 as select f1,f2 from t3;
|
create view v3 as select f1,f2 from t3;
|
||||||
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
||||||
@ -129,13 +151,41 @@ connect (testdb_2,localhost,testdb_2,,test);
|
|||||||
create view v2 as select f1 from testdb_1.v1;
|
create view v2 as select f1 from testdb_1.v1;
|
||||||
create view v4 as select f1,f2 from testdb_1.v3;
|
create view v4 as select f1,f2 from testdb_1.v3;
|
||||||
|
|
||||||
|
show fields from testdb_1.v5;
|
||||||
|
show create view testdb_1.v5;
|
||||||
|
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
|
||||||
connection testdb_1;
|
connection testdb_1;
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
|
||||||
revoke insert(f1) on v3 from testdb_2@localhost;
|
revoke insert(f1) on v3 from testdb_2@localhost;
|
||||||
|
revoke show view on v5 from testdb_2@localhost;
|
||||||
|
connection default;
|
||||||
|
use testdb_1;
|
||||||
|
revoke show view on v6 from testdb_2@localhost;
|
||||||
connection testdb_2;
|
connection testdb_2;
|
||||||
|
|
||||||
|
--error 1142
|
||||||
|
show fields from testdb_1.v5;
|
||||||
|
--error 1142
|
||||||
|
show create view testdb_1.v5;
|
||||||
|
|
||||||
|
--error 1142
|
||||||
|
show fields from testdb_1.v6;
|
||||||
|
--error 1142
|
||||||
|
show create view testdb_1.v6;
|
||||||
|
|
||||||
|
--error 1142
|
||||||
|
show fields from testdb_1.v7;
|
||||||
|
--error 1142
|
||||||
|
show create view testdb_1.v7;
|
||||||
|
|
||||||
--error 1345
|
--error 1345
|
||||||
show create view v4;
|
show create view v4;
|
||||||
--error 1345
|
#--error 1345
|
||||||
show fields from v4;
|
show fields from v4;
|
||||||
|
|
||||||
show fields from v2;
|
show fields from v2;
|
||||||
@ -155,7 +205,8 @@ where a.table_name = 'testdb_1.v1';
|
|||||||
select * from v2;
|
select * from v2;
|
||||||
|
|
||||||
connection default;
|
connection default;
|
||||||
drop view testdb_1.v1,v2, testdb_1.v3, v4;
|
use test;
|
||||||
|
drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
||||||
drop database testdb_1;
|
drop database testdb_1;
|
||||||
drop user testdb_1@localhost;
|
drop user testdb_1@localhost;
|
||||||
drop user testdb_2@localhost;
|
drop user testdb_2@localhost;
|
||||||
|
@ -6946,3 +6946,27 @@ DROP TABLE t3|
|
|||||||
# practical, or create table t3, t4 etc temporarily (and drop them).
|
# practical, or create table t3, t4 etc temporarily (and drop them).
|
||||||
delimiter ;|
|
delimiter ;|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
|
||||||
|
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
|
||||||
|
set @a=0;
|
||||||
|
|
||||||
|
delimiter |;
|
||||||
|
CREATE function bug27354() RETURNS int deterministic
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
set @a=@a+1;
|
||||||
|
return @a;
|
||||||
|
end|
|
||||||
|
|
||||||
|
delimiter ;|
|
||||||
|
update t2 set b=1 where a=bug27354();
|
||||||
|
select count(t_1.a),count(t_2.a) from t1 as t_1, t2 as t_2 /* must be 0,0 */;
|
||||||
|
insert into t2 values (1,1),(2,2),(3,3);
|
||||||
|
update t2 set b=-b where a=bug27354();
|
||||||
|
select * from t2 /* must return 1,-1 ... */;
|
||||||
|
select count(*) from t1 /* must be 3 */;
|
||||||
|
|
||||||
|
|
||||||
|
drop table t1,t2;
|
||||||
|
drop function bug27354;
|
||||||
|
@ -553,6 +553,37 @@ drop procedure bug14210|
|
|||||||
set @@session.max_heap_table_size=default|
|
set @@session.max_heap_table_size=default|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #13270 INSERT,UPDATE,etc that calls func with side-effect does not binlog
|
||||||
|
# Bug #23333 stored function + non-transac table + transac table =
|
||||||
|
# breaks stmt-based binlog
|
||||||
|
# Bug #27395 OPTION_STATUS_NO_TRANS_UPDATE is not preserved at the end of SF()
|
||||||
|
#
|
||||||
|
--disable_warnings
|
||||||
|
drop function if exists bug23333|
|
||||||
|
drop table if exists t1,t2|
|
||||||
|
--enable_warnings
|
||||||
|
CREATE TABLE t1 (a int NOT NULL auto_increment primary key) ENGINE=MyISAM|
|
||||||
|
CREATE TABLE t2 (a int NOT NULL auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB|
|
||||||
|
|
||||||
|
reset master|
|
||||||
|
insert into t2 values (1,1)|
|
||||||
|
|
||||||
|
create function bug23333()
|
||||||
|
RETURNS int(11)
|
||||||
|
DETERMINISTIC
|
||||||
|
begin
|
||||||
|
insert into t1 values (null);
|
||||||
|
select count(*) from t1 into @a;
|
||||||
|
return @a;
|
||||||
|
end|
|
||||||
|
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
insert into t2 values (bug23333(),1)|
|
||||||
|
--replace_column 2 # 5 #
|
||||||
|
show binlog events from 98 /* must show the insert */|
|
||||||
|
select count(*),@a from t1 /* must be 1,1 */|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#NNNN: New bug synopsis
|
# BUG#NNNN: New bug synopsis
|
||||||
#
|
#
|
||||||
|
@ -3636,8 +3636,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||||||
{
|
{
|
||||||
m_transaction_on= FALSE;
|
m_transaction_on= FALSE;
|
||||||
/* Would be simpler if has_transactions() didn't always say "yes" */
|
/* Would be simpler if has_transactions() didn't always say "yes" */
|
||||||
thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= thd->no_trans_update.stmt= TRUE;
|
||||||
thd->no_trans_update= TRUE;
|
|
||||||
}
|
}
|
||||||
else if (!thd->transaction.on)
|
else if (!thd->transaction.on)
|
||||||
m_transaction_on= FALSE;
|
m_transaction_on= FALSE;
|
||||||
|
@ -830,7 +830,7 @@ int ha_rollback_trans(THD *thd, bool all)
|
|||||||
the error log; but we don't want users to wonder why they have this
|
the error log; but we don't want users to wonder why they have this
|
||||||
message in the error log, so we don't send it.
|
message in the error log, so we don't send it.
|
||||||
*/
|
*/
|
||||||
if (is_real_trans && (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) &&
|
if (is_real_trans && thd->no_trans_update.all &&
|
||||||
!thd->slave_thread)
|
!thd->slave_thread)
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
||||||
|
@ -1411,7 +1411,7 @@ private:
|
|||||||
bool execute(Field **flp);
|
bool execute(Field **flp);
|
||||||
bool execute_impl(THD *thd, Field *return_value_fld);
|
bool execute_impl(THD *thd, Field *return_value_fld);
|
||||||
Field *sp_result_field(void) const;
|
Field *sp_result_field(void) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Item_func_sp(Name_resolution_context *context_arg, sp_name *name);
|
Item_func_sp(Name_resolution_context *context_arg, sp_name *name);
|
||||||
@ -1422,6 +1422,8 @@ public:
|
|||||||
virtual ~Item_func_sp()
|
virtual ~Item_func_sp()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
table_map used_tables() const { return RAND_TABLE_BIT; }
|
||||||
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
const char *func_name() const;
|
const char *func_name() const;
|
||||||
|
@ -162,7 +162,7 @@ static int binlog_rollback(THD *thd, bool all)
|
|||||||
table. Such cases should be rare (updating a
|
table. Such cases should be rare (updating a
|
||||||
non-transactional table inside a transaction...)
|
non-transactional table inside a transaction...)
|
||||||
*/
|
*/
|
||||||
if (unlikely(thd->options & OPTION_STATUS_NO_TRANS_UPDATE))
|
if (unlikely(thd->no_trans_update.all))
|
||||||
{
|
{
|
||||||
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
|
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, FALSE);
|
||||||
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
|
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
|
||||||
@ -217,7 +217,7 @@ static int binlog_savepoint_rollback(THD *thd, void *sv)
|
|||||||
non-transactional table. Otherwise, truncate the binlog cache starting
|
non-transactional table. Otherwise, truncate the binlog cache starting
|
||||||
from the SAVEPOINT command.
|
from the SAVEPOINT command.
|
||||||
*/
|
*/
|
||||||
if (unlikely(thd->options & OPTION_STATUS_NO_TRANS_UPDATE))
|
if (unlikely(thd->no_trans_update.all))
|
||||||
{
|
{
|
||||||
Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE);
|
Query_log_event qinfo(thd, thd->query, thd->query_length, TRUE, FALSE);
|
||||||
DBUG_RETURN(mysql_bin_log.write(&qinfo));
|
DBUG_RETURN(mysql_bin_log.write(&qinfo));
|
||||||
|
@ -347,9 +347,6 @@ MY_LOCALE *my_locale_by_number(uint number);
|
|||||||
in the user query has requested */
|
in the user query has requested */
|
||||||
#define SELECT_ALL (ULL(1) << 24) // SELECT, user, parser
|
#define SELECT_ALL (ULL(1) << 24) // SELECT, user, parser
|
||||||
|
|
||||||
/* Set if we are updating a non-transaction safe table */
|
|
||||||
#define OPTION_STATUS_NO_TRANS_UPDATE (ULL(1) << 25) // THD, intern
|
|
||||||
|
|
||||||
/* The following can be set when importing tables in a 'wrong order'
|
/* The following can be set when importing tables in a 'wrong order'
|
||||||
to suppress foreign key checks */
|
to suppress foreign key checks */
|
||||||
#define OPTION_NO_FOREIGN_KEY_CHECKS (ULL(1) << 26) // THD, user, binlog
|
#define OPTION_NO_FOREIGN_KEY_CHECKS (ULL(1) << 26) // THD, user, binlog
|
||||||
|
@ -2873,14 +2873,15 @@ static bool set_option_autocommit(THD *thd, set_var *var)
|
|||||||
if ((org_options & OPTION_NOT_AUTOCOMMIT))
|
if ((org_options & OPTION_NOT_AUTOCOMMIT))
|
||||||
{
|
{
|
||||||
/* We changed to auto_commit mode */
|
/* We changed to auto_commit mode */
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||||
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
|
thd->server_status|= SERVER_STATUS_AUTOCOMMIT;
|
||||||
if (ha_commit(thd))
|
if (ha_commit(thd))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thd->options&= ~(ulong) (OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
|
thd->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,13 +337,13 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
|
|||||||
|
|
||||||
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
|
enum_check_fields save_count_cuted_fields= thd->count_cuted_fields;
|
||||||
bool save_abort_on_warning= thd->abort_on_warning;
|
bool save_abort_on_warning= thd->abort_on_warning;
|
||||||
bool save_no_trans_update= thd->no_trans_update;
|
bool save_no_trans_update_stmt= thd->no_trans_update.stmt;
|
||||||
|
|
||||||
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
|
thd->count_cuted_fields= CHECK_FIELD_ERROR_FOR_NULL;
|
||||||
thd->abort_on_warning=
|
thd->abort_on_warning=
|
||||||
thd->variables.sql_mode &
|
thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES);
|
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES);
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
|
|
||||||
/* Save the value in the field. Convert the value if needed. */
|
/* Save the value in the field. Convert the value if needed. */
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr)
|
|||||||
|
|
||||||
thd->count_cuted_fields= save_count_cuted_fields;
|
thd->count_cuted_fields= save_count_cuted_fields;
|
||||||
thd->abort_on_warning= save_abort_on_warning;
|
thd->abort_on_warning= save_abort_on_warning;
|
||||||
thd->no_trans_update= save_no_trans_update;
|
thd->no_trans_update.stmt= save_no_trans_update_stmt;
|
||||||
|
|
||||||
if (thd->net.report_error)
|
if (thd->net.report_error)
|
||||||
{
|
{
|
||||||
|
@ -3573,14 +3573,35 @@ find_field_in_tables(THD *thd, Item_ident *item,
|
|||||||
{
|
{
|
||||||
Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length,
|
Field *cur_field= find_field_in_table_ref(thd, cur_table, name, length,
|
||||||
item->name, db, table_name, ref,
|
item->name, db, table_name, ref,
|
||||||
check_privileges, allow_rowid,
|
check_privileges,
|
||||||
|
allow_rowid,
|
||||||
&(item->cached_field_index),
|
&(item->cached_field_index),
|
||||||
register_tree_change,
|
register_tree_change,
|
||||||
&actual_table);
|
&actual_table);
|
||||||
if (cur_field)
|
if (cur_field)
|
||||||
{
|
{
|
||||||
if (cur_field == WRONG_GRANT)
|
if (cur_field == WRONG_GRANT)
|
||||||
return (Field*) 0;
|
{
|
||||||
|
if (thd->lex->sql_command != SQLCOM_SHOW_FIELDS)
|
||||||
|
return (Field*) 0;
|
||||||
|
|
||||||
|
thd->clear_error();
|
||||||
|
cur_field= find_field_in_table_ref(thd, cur_table, name, length,
|
||||||
|
item->name, db, table_name, ref,
|
||||||
|
false,
|
||||||
|
allow_rowid,
|
||||||
|
&(item->cached_field_index),
|
||||||
|
register_tree_change,
|
||||||
|
&actual_table);
|
||||||
|
if (cur_field)
|
||||||
|
{
|
||||||
|
Field *nf=new Field_null(NULL,0,Field::NONE,
|
||||||
|
cur_field->field_name,
|
||||||
|
cur_field->table,
|
||||||
|
&my_charset_bin);
|
||||||
|
cur_field= nf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Store the original table of the field, which may be different from
|
Store the original table of the field, which may be different from
|
||||||
@ -3603,7 +3624,7 @@ find_field_in_tables(THD *thd, Item_ident *item,
|
|||||||
report_error == IGNORE_EXCEPT_NON_UNIQUE)
|
report_error == IGNORE_EXCEPT_NON_UNIQUE)
|
||||||
my_error(ER_NON_UNIQ_ERROR, MYF(0),
|
my_error(ER_NON_UNIQ_ERROR, MYF(0),
|
||||||
table_name ? item->full_name() : name, thd->where);
|
table_name ? item->full_name() : name, thd->where);
|
||||||
return (Field*) 0;
|
return (Field*) 0;
|
||||||
}
|
}
|
||||||
found= cur_field;
|
found= cur_field;
|
||||||
}
|
}
|
||||||
|
@ -1440,7 +1440,11 @@ public:
|
|||||||
bool charset_is_system_charset, charset_is_collation_connection;
|
bool charset_is_system_charset, charset_is_collation_connection;
|
||||||
bool charset_is_character_set_filesystem;
|
bool charset_is_character_set_filesystem;
|
||||||
bool enable_slow_log; /* enable slow log for current statement */
|
bool enable_slow_log; /* enable slow log for current statement */
|
||||||
bool no_trans_update, abort_on_warning;
|
struct {
|
||||||
|
bool all:1;
|
||||||
|
bool stmt:1;
|
||||||
|
} no_trans_update;
|
||||||
|
bool abort_on_warning;
|
||||||
bool got_warning; /* Set on call to push_warning() */
|
bool got_warning; /* Set on call to push_warning() */
|
||||||
bool no_warnings_for_error; /* no warnings on call to my_error() */
|
bool no_warnings_for_error; /* no warnings on call to my_error() */
|
||||||
/* set during loop of derived table processing */
|
/* set during loop of derived table processing */
|
||||||
@ -1667,7 +1671,7 @@ public:
|
|||||||
inline bool really_abort_on_warning()
|
inline bool really_abort_on_warning()
|
||||||
{
|
{
|
||||||
return (abort_on_warning &&
|
return (abort_on_warning &&
|
||||||
(!no_trans_update ||
|
(!no_trans_update.stmt ||
|
||||||
(variables.sql_mode & MODE_STRICT_ALL_TABLES)));
|
(variables.sql_mode & MODE_STRICT_ALL_TABLES)));
|
||||||
}
|
}
|
||||||
void set_status_var_init();
|
void set_status_var_init();
|
||||||
|
@ -311,7 +311,7 @@ cleanup:
|
|||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
free_underlaid_joins(thd, select_lex);
|
free_underlaid_joins(thd, select_lex);
|
||||||
if (transactional_table)
|
if (transactional_table)
|
||||||
@ -791,7 +791,7 @@ bool multi_delete::send_eof()
|
|||||||
local_error=1; // Log write failed: roll back the SQL statement
|
local_error=1; // Log write failed: roll back the SQL statement
|
||||||
}
|
}
|
||||||
if (!transactional_tables)
|
if (!transactional_tables)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
/* Commit or rollback the current SQL statement */
|
/* Commit or rollback the current SQL statement */
|
||||||
if (transactional_tables)
|
if (transactional_tables)
|
||||||
|
@ -584,7 +584,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
|
if (lock_type != TL_WRITE_DELAYED && !thd->prelocked_mode)
|
||||||
table->file->start_bulk_insert(values_list.elements);
|
table->file->start_bulk_insert(values_list.elements);
|
||||||
|
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
|
thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
MODE_STRICT_ALL_TABLES)));
|
MODE_STRICT_ALL_TABLES)));
|
||||||
@ -731,7 +731,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transactional_table)
|
if (transactional_table)
|
||||||
@ -1129,7 +1129,7 @@ static int last_uniq_key(TABLE *table,uint keynr)
|
|||||||
then both on update triggers will work instead. Similarly both on
|
then both on update triggers will work instead. Similarly both on
|
||||||
delete triggers will be invoked if we will delete conflicting records.
|
delete triggers will be invoked if we will delete conflicting records.
|
||||||
|
|
||||||
Sets thd->no_trans_update if table which is updated didn't have
|
Sets thd->no_trans_update.stmt to TRUE if table which is updated didn't have
|
||||||
transactions.
|
transactions.
|
||||||
|
|
||||||
RETURN VALUE
|
RETURN VALUE
|
||||||
@ -1295,7 +1295,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
|||||||
goto err;
|
goto err;
|
||||||
info->deleted++;
|
info->deleted++;
|
||||||
if (!table->file->has_transactions())
|
if (!table->file->has_transactions())
|
||||||
thd->no_trans_update= 1;
|
thd->no_trans_update.stmt= TRUE;
|
||||||
if (table->triggers &&
|
if (table->triggers &&
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
|
||||||
TRG_ACTION_AFTER, TRUE))
|
TRG_ACTION_AFTER, TRUE))
|
||||||
@ -1327,7 +1327,7 @@ ok_or_after_trg_err:
|
|||||||
if (key)
|
if (key)
|
||||||
my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
|
my_safe_afree(key,table->s->max_unique_length,MAX_KEY_LENGTH);
|
||||||
if (!table->file->has_transactions())
|
if (!table->file->has_transactions())
|
||||||
thd->no_trans_update= 1;
|
thd->no_trans_update.stmt= TRUE;
|
||||||
DBUG_RETURN(trg_error);
|
DBUG_RETURN(trg_error);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@ -2520,7 +2520,7 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
|
table->file->extra(HA_EXTRA_WRITE_CAN_REPLACE);
|
||||||
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
|
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
|
||||||
}
|
}
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!info.ignore &&
|
thd->abort_on_warning= (!info.ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
@ -2678,7 +2678,7 @@ void select_insert::send_error(uint errcode,const char *err)
|
|||||||
mysql_bin_log.write(&qinfo);
|
mysql_bin_log.write(&qinfo);
|
||||||
}
|
}
|
||||||
if (!table->s->tmp_table)
|
if (!table->s->tmp_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
if (info.copied || info.deleted || info.updated)
|
if (info.copied || info.deleted || info.updated)
|
||||||
{
|
{
|
||||||
@ -2707,7 +2707,7 @@ bool select_insert::send_eof()
|
|||||||
{
|
{
|
||||||
query_cache_invalidate3(thd, table, 1);
|
query_cache_invalidate3(thd, table, 1);
|
||||||
if (!(table->file->has_transactions() || table->s->tmp_table))
|
if (!(table->file->has_transactions() || table->s->tmp_table))
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_insert_id)
|
if (last_insert_id)
|
||||||
@ -2933,7 +2933,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
}
|
}
|
||||||
if (!thd->prelocked_mode)
|
if (!thd->prelocked_mode)
|
||||||
table->file->start_bulk_insert((ha_rows) 0);
|
table->file->start_bulk_insert((ha_rows) 0);
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!info.ignore &&
|
thd->abort_on_warning= (!info.ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
|
@ -377,7 +377,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
table->file->start_bulk_insert((ha_rows) 0);
|
table->file->start_bulk_insert((ha_rows) 0);
|
||||||
table->copy_blobs=1;
|
table->copy_blobs=1;
|
||||||
|
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= (!ignore &&
|
thd->abort_on_warning= (!ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
@ -467,7 +467,7 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
(ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
|
(ulong) (info.records - info.copied), (ulong) thd->cuted_fields);
|
||||||
|
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
@ -531,7 +531,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
Item_field *sql_field;
|
Item_field *sql_field;
|
||||||
TABLE *table= table_list->table;
|
TABLE *table= table_list->table;
|
||||||
ulonglong id;
|
ulonglong id;
|
||||||
bool no_trans_update;
|
bool no_trans_update_stmt;
|
||||||
DBUG_ENTER("read_fixed_length");
|
DBUG_ENTER("read_fixed_length");
|
||||||
|
|
||||||
id= 0;
|
id= 0;
|
||||||
@ -559,7 +559,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
#ifdef HAVE_purify
|
#ifdef HAVE_purify
|
||||||
read_info.row_end[0]=0;
|
read_info.row_end[0]=0;
|
||||||
#endif
|
#endif
|
||||||
no_trans_update= !table->file->has_transactions();
|
no_trans_update_stmt= !table->file->has_transactions();
|
||||||
|
|
||||||
restore_record(table, s->default_values);
|
restore_record(table, s->default_values);
|
||||||
/*
|
/*
|
||||||
@ -627,7 +627,7 @@ read_fixed_length(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
|
|
||||||
if (write_record(thd, table, &info))
|
if (write_record(thd, table, &info))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
thd->no_trans_update= no_trans_update;
|
thd->no_trans_update.stmt= no_trans_update_stmt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If auto_increment values are used, save the first one for
|
If auto_increment values are used, save the first one for
|
||||||
@ -670,12 +670,12 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
TABLE *table= table_list->table;
|
TABLE *table= table_list->table;
|
||||||
uint enclosed_length;
|
uint enclosed_length;
|
||||||
ulonglong id;
|
ulonglong id;
|
||||||
bool no_trans_update;
|
bool no_trans_update_stmt;
|
||||||
DBUG_ENTER("read_sep_field");
|
DBUG_ENTER("read_sep_field");
|
||||||
|
|
||||||
enclosed_length=enclosed.length();
|
enclosed_length=enclosed.length();
|
||||||
id= 0;
|
id= 0;
|
||||||
no_trans_update= !table->file->has_transactions();
|
no_trans_update_stmt= !table->file->has_transactions();
|
||||||
|
|
||||||
for (;;it.rewind())
|
for (;;it.rewind())
|
||||||
{
|
{
|
||||||
@ -817,7 +817,7 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
|
|||||||
We don't need to reset auto-increment field since we are restoring
|
We don't need to reset auto-increment field since we are restoring
|
||||||
its default value at the beginning of each loop iteration.
|
its default value at the beginning of each loop iteration.
|
||||||
*/
|
*/
|
||||||
thd->no_trans_update= no_trans_update;
|
thd->no_trans_update.stmt= no_trans_update_stmt;
|
||||||
if (read_info.next_line()) // Skip to next line
|
if (read_info.next_line()) // Skip to next line
|
||||||
break;
|
break;
|
||||||
if (read_info.line_cuted)
|
if (read_info.line_cuted)
|
||||||
|
@ -147,7 +147,8 @@ static bool end_active_trans(THD *thd)
|
|||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
if (ha_commit(thd))
|
if (ha_commit(thd))
|
||||||
error=1;
|
error=1;
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||||
|
thd->no_trans_update.all= FALSE;
|
||||||
}
|
}
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
@ -171,8 +172,8 @@ static bool begin_trans(THD *thd)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
LEX *lex= thd->lex;
|
LEX *lex= thd->lex;
|
||||||
thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) |
|
thd->no_trans_update.all= FALSE;
|
||||||
OPTION_BEGIN);
|
thd->options|= (ulong) OPTION_BEGIN;
|
||||||
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
||||||
if (lex->start_transaction_opt & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT)
|
if (lex->start_transaction_opt & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT)
|
||||||
error= ha_start_consistent_snapshot(thd);
|
error= ha_start_consistent_snapshot(thd);
|
||||||
@ -1463,7 +1464,8 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
|
|||||||
*/
|
*/
|
||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
res= ha_commit(thd);
|
res= ha_commit(thd);
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||||
|
thd->no_trans_update.all= FALSE;
|
||||||
break;
|
break;
|
||||||
case COMMIT_RELEASE:
|
case COMMIT_RELEASE:
|
||||||
do_release= 1; /* fall through */
|
do_release= 1; /* fall through */
|
||||||
@ -1480,7 +1482,8 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
|
|||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
if (ha_rollback(thd))
|
if (ha_rollback(thd))
|
||||||
res= -1;
|
res= -1;
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||||
|
thd->no_trans_update.all= FALSE;
|
||||||
if (!res && (completion == ROLLBACK_AND_CHAIN))
|
if (!res && (completion == ROLLBACK_AND_CHAIN))
|
||||||
res= begin_trans(thd);
|
res= begin_trans(thd);
|
||||||
break;
|
break;
|
||||||
@ -2933,7 +2936,7 @@ mysql_execute_command(THD *thd)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
|
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
|
||||||
thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||||
bool link_to_local;
|
bool link_to_local;
|
||||||
@ -3707,10 +3710,10 @@ end_with_restore_list:
|
|||||||
we silently add IF EXISTS if TEMPORARY was used.
|
we silently add IF EXISTS if TEMPORARY was used.
|
||||||
*/
|
*/
|
||||||
if (thd->slave_thread)
|
if (thd->slave_thread)
|
||||||
lex->drop_if_exists= 1;
|
lex->drop_if_exists= 1;
|
||||||
|
|
||||||
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
|
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
|
||||||
thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
/* DDL and binlog write order protected by LOCK_open */
|
/* DDL and binlog write order protected by LOCK_open */
|
||||||
res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
|
res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
|
||||||
@ -4296,7 +4299,7 @@ end_with_restore_list:
|
|||||||
res= TRUE; // cannot happen
|
res= TRUE; // cannot happen
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((thd->options & OPTION_STATUS_NO_TRANS_UPDATE) &&
|
if (thd->no_trans_update.all &&
|
||||||
!thd->slave_thread)
|
!thd->slave_thread)
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
ER_WARNING_NOT_COMPLETE_ROLLBACK,
|
||||||
@ -4939,8 +4942,8 @@ create_sp_error:
|
|||||||
thd->transaction.xid_state.xa_state=XA_ACTIVE;
|
thd->transaction.xid_state.xa_state=XA_ACTIVE;
|
||||||
thd->transaction.xid_state.xid.set(thd->lex->xid);
|
thd->transaction.xid_state.xid.set(thd->lex->xid);
|
||||||
xid_cache_insert(&thd->transaction.xid_state);
|
xid_cache_insert(&thd->transaction.xid_state);
|
||||||
thd->options= ((thd->options & (ulong) ~(OPTION_STATUS_NO_TRANS_UPDATE)) |
|
thd->no_trans_update.all= FALSE;
|
||||||
OPTION_BEGIN);
|
thd->options|= (ulong) OPTION_BEGIN;
|
||||||
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
break;
|
break;
|
||||||
@ -5033,7 +5036,8 @@ create_sp_error:
|
|||||||
xa_state_names[thd->transaction.xid_state.xa_state]);
|
xa_state_names[thd->transaction.xid_state.xa_state]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||||
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
xid_cache_delete(&thd->transaction.xid_state);
|
xid_cache_delete(&thd->transaction.xid_state);
|
||||||
thd->transaction.xid_state.xa_state=XA_NOTR;
|
thd->transaction.xid_state.xa_state=XA_NOTR;
|
||||||
@ -5063,7 +5067,8 @@ create_sp_error:
|
|||||||
my_error(ER_XAER_RMERR, MYF(0));
|
my_error(ER_XAER_RMERR, MYF(0));
|
||||||
else
|
else
|
||||||
send_ok(thd);
|
send_ok(thd);
|
||||||
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
|
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||||
|
thd->no_trans_update.all= FALSE;
|
||||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||||
xid_cache_delete(&thd->transaction.xid_state);
|
xid_cache_delete(&thd->transaction.xid_state);
|
||||||
thd->transaction.xid_state.xa_state=XA_NOTR;
|
thd->transaction.xid_state.xa_state=XA_NOTR;
|
||||||
@ -5159,7 +5164,10 @@ bool check_single_table_access(THD *thd, ulong privilege,
|
|||||||
goto deny;
|
goto deny;
|
||||||
|
|
||||||
/* Show only 1 table for check_grant */
|
/* Show only 1 table for check_grant */
|
||||||
if (grant_option && check_grant(thd, privilege, all_tables, 0, 1, 0))
|
if (grant_option &&
|
||||||
|
!(all_tables->belong_to_view &&
|
||||||
|
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
|
||||||
|
check_grant(thd, privilege, all_tables, 0, 1, 0))
|
||||||
goto deny;
|
goto deny;
|
||||||
|
|
||||||
thd->security_ctx= backup_ctx;
|
thd->security_ctx= backup_ctx;
|
||||||
|
@ -3968,7 +3968,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
|||||||
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
|
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
|
||||||
|
|
||||||
/* We can abort alter table for any table type */
|
/* We can abort alter table for any table type */
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= !ignore && test(thd->variables.sql_mode &
|
thd->abort_on_warning= !ignore && test(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
MODE_STRICT_ALL_TABLES));
|
MODE_STRICT_ALL_TABLES));
|
||||||
|
@ -429,7 +429,7 @@ int mysql_update(THD *thd,
|
|||||||
query_id=thd->query_id;
|
query_id=thd->query_id;
|
||||||
|
|
||||||
transactional_table= table->file->has_transactions();
|
transactional_table= table->file->has_transactions();
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= test(!ignore &&
|
thd->abort_on_warning= test(!ignore &&
|
||||||
(thd->variables.sql_mode &
|
(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
@ -452,7 +452,7 @@ int mysql_update(THD *thd,
|
|||||||
if (fill_record_n_invoke_before_triggers(thd, fields, values, 0,
|
if (fill_record_n_invoke_before_triggers(thd, fields, values, 0,
|
||||||
table->triggers,
|
table->triggers,
|
||||||
TRG_EVENT_UPDATE))
|
TRG_EVENT_UPDATE))
|
||||||
break; /* purecov: inspected */
|
break; /* purecov: inspected */
|
||||||
|
|
||||||
found++;
|
found++;
|
||||||
|
|
||||||
@ -470,12 +470,12 @@ int mysql_update(THD *thd,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(error=table->file->update_row((byte*) table->record[1],
|
if (!(error=table->file->update_row((byte*) table->record[1],
|
||||||
(byte*) table->record[0])))
|
(byte*) table->record[0])))
|
||||||
{
|
{
|
||||||
updated++;
|
updated++;
|
||||||
thd->no_trans_update= !transactional_table;
|
thd->no_trans_update.stmt= !transactional_table;
|
||||||
|
|
||||||
if (table->triggers &&
|
if (table->triggers &&
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
||||||
TRG_ACTION_AFTER, TRUE))
|
TRG_ACTION_AFTER, TRUE))
|
||||||
@ -483,25 +483,25 @@ int mysql_update(THD *thd,
|
|||||||
error= 1;
|
error= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!ignore || error != HA_ERR_FOUND_DUPP_KEY)
|
else if (!ignore || error != HA_ERR_FOUND_DUPP_KEY)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to
|
If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to
|
||||||
do anything; otherwise...
|
do anything; otherwise...
|
||||||
*/
|
*/
|
||||||
if (error != HA_ERR_FOUND_DUPP_KEY)
|
if (error != HA_ERR_FOUND_DUPP_KEY)
|
||||||
thd->fatal_error(); /* Other handler errors are fatal */
|
thd->fatal_error(); /* Other handler errors are fatal */
|
||||||
table->file->print_error(error,MYF(0));
|
table->file->print_error(error,MYF(0));
|
||||||
error= 1;
|
error= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!--limit && using_limit)
|
if (!--limit && using_limit)
|
||||||
{
|
{
|
||||||
error= -1; // Simulate end of file
|
error= -1; // Simulate end of file
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -546,7 +546,7 @@ int mysql_update(THD *thd,
|
|||||||
error=1; // Rollback update
|
error=1; // Rollback update
|
||||||
}
|
}
|
||||||
if (!transactional_table)
|
if (!transactional_table)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
free_underlaid_joins(thd, select_lex);
|
free_underlaid_joins(thd, select_lex);
|
||||||
if (transactional_table)
|
if (transactional_table)
|
||||||
@ -910,7 +910,7 @@ bool mysql_multi_update(THD *thd,
|
|||||||
handle_duplicates, ignore)))
|
handle_duplicates, ignore)))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
thd->no_trans_update= 0;
|
thd->no_trans_update.stmt= FALSE;
|
||||||
thd->abort_on_warning= test(thd->variables.sql_mode &
|
thd->abort_on_warning= test(thd->variables.sql_mode &
|
||||||
(MODE_STRICT_TRANS_TABLES |
|
(MODE_STRICT_TRANS_TABLES |
|
||||||
MODE_STRICT_ALL_TABLES));
|
MODE_STRICT_ALL_TABLES));
|
||||||
@ -1224,7 +1224,7 @@ multi_update::~multi_update()
|
|||||||
delete [] copy_field;
|
delete [] copy_field;
|
||||||
thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting
|
thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting
|
||||||
if (!trans_safe)
|
if (!trans_safe)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1311,7 +1311,7 @@ bool multi_update::send_data(List<Item> ¬_used_values)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!table->file->has_transactions())
|
if (!table->file->has_transactions())
|
||||||
thd->no_trans_update= 1;
|
thd->no_trans_update.stmt= TRUE;
|
||||||
if (table->triggers &&
|
if (table->triggers &&
|
||||||
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
|
||||||
TRG_ACTION_AFTER, TRUE))
|
TRG_ACTION_AFTER, TRUE))
|
||||||
@ -1541,10 +1541,10 @@ bool multi_update::send_eof()
|
|||||||
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
Query_log_event qinfo(thd, thd->query, thd->query_length,
|
||||||
transactional_tables, FALSE);
|
transactional_tables, FALSE);
|
||||||
if (mysql_bin_log.write(&qinfo) && trans_safe)
|
if (mysql_bin_log.write(&qinfo) && trans_safe)
|
||||||
local_error= 1; // Rollback update
|
local_error= 1; // Rollback update
|
||||||
}
|
}
|
||||||
if (!transactional_tables)
|
if (!transactional_tables)
|
||||||
thd->options|=OPTION_STATUS_NO_TRANS_UPDATE;
|
thd->no_trans_update.all= TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transactional_tables)
|
if (transactional_tables)
|
||||||
|
@ -1018,6 +1018,11 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||||||
CHARSET_INFO *save_cs= thd->variables.character_set_client;
|
CHARSET_INFO *save_cs= thd->variables.character_set_client;
|
||||||
thd->variables.character_set_client= system_charset_info;
|
thd->variables.character_set_client= system_charset_info;
|
||||||
res= MYSQLparse((void *)thd);
|
res= MYSQLparse((void *)thd);
|
||||||
|
|
||||||
|
if ((old_lex->sql_command == SQLCOM_SHOW_FIELDS) ||
|
||||||
|
(old_lex->sql_command == SQLCOM_SHOW_CREATE))
|
||||||
|
lex->sql_command= old_lex->sql_command;
|
||||||
|
|
||||||
thd->variables.character_set_client= save_cs;
|
thd->variables.character_set_client= save_cs;
|
||||||
thd->variables.sql_mode= save_mode;
|
thd->variables.sql_mode= save_mode;
|
||||||
}
|
}
|
||||||
@ -1043,7 +1048,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!table->prelocking_placeholder &&
|
else if (!table->prelocking_placeholder &&
|
||||||
old_lex->sql_command == SQLCOM_SHOW_CREATE &&
|
(old_lex->sql_command == SQLCOM_SHOW_CREATE) &&
|
||||||
!table->belong_to_view)
|
!table->belong_to_view)
|
||||||
{
|
{
|
||||||
if (check_table_access(thd, SHOW_VIEW_ACL, table, 0))
|
if (check_table_access(thd, SHOW_VIEW_ACL, table, 0))
|
||||||
|
@ -2085,7 +2085,7 @@ void st_table_list::hide_view_error(THD *thd)
|
|||||||
thd->net.last_errno == ER_NO_SUCH_TABLE)
|
thd->net.last_errno == ER_NO_SUCH_TABLE)
|
||||||
{
|
{
|
||||||
TABLE_LIST *top= top_table();
|
TABLE_LIST *top= top_table();
|
||||||
thd->clear_error();
|
thd->clear_error();
|
||||||
my_error(ER_VIEW_INVALID, MYF(0), top->view_db.str, top->view_name.str);
|
my_error(ER_VIEW_INVALID, MYF(0), top->view_db.str, top->view_name.str);
|
||||||
}
|
}
|
||||||
else if (thd->net.last_errno == ER_NO_DEFAULT_FOR_FIELD)
|
else if (thd->net.last_errno == ER_NO_DEFAULT_FOR_FIELD)
|
||||||
@ -2441,7 +2441,8 @@ bool st_table_list::prepare_view_securety_context(THD *thd)
|
|||||||
definer.host.str,
|
definer.host.str,
|
||||||
thd->db))
|
thd->db))
|
||||||
{
|
{
|
||||||
if (thd->lex->sql_command == SQLCOM_SHOW_CREATE)
|
if ((thd->lex->sql_command == SQLCOM_SHOW_CREATE) ||
|
||||||
|
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS))
|
||||||
{
|
{
|
||||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||||
ER_NO_SUCH_USER,
|
ER_NO_SUCH_USER,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user