Commit 469d7c12 authored by unknown's avatar unknown

merge


sql/mysql_priv.h:
  Auto merged
sql/repl_failsafe.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/set_var.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_repl.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.cc:
  Auto merged
parents 59e6d106 258c9e9d
...@@ -594,7 +594,7 @@ TABLE_CONSTRAINTS ...@@ -594,7 +594,7 @@ TABLE_CONSTRAINTS
TABLE_PRIVILEGES TABLE_PRIVILEGES
TRIGGERS TRIGGERS
create database information_schema; create database information_schema;
ERROR HY000: Can't create database 'information_schema'; database exists ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
use information_schema; use information_schema;
show full tables like "T%"; show full tables like "T%";
Tables_in_information_schema (T%) Table_type Tables_in_information_schema (T%) Table_type
...@@ -990,3 +990,25 @@ Field Type Null Key Default Extra ...@@ -990,3 +990,25 @@ Field Type Null Key Default Extra
c int(11) YES NULL c int(11) YES NULL
drop view v1; drop view v1;
drop table t1; drop table t1;
alter database information_schema;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
drop database information_schema;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
drop table information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
alter table information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
use information_schema;
create temporary table schemata(f1 char(10));
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE PROCEDURE p1 ()
BEGIN
SELECT 'foo' FROM DUAL;
END |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
select ROUTINE_NAME from routines;
ROUTINE_NAME
grant all on information_schema.* to 'user1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
grant select on information_schema.* to 'user1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
...@@ -140,6 +140,64 @@ b+0 ...@@ -140,6 +140,64 @@ b+0
499 499
drop table t1; drop table t1;
create table t1 ( create table t1 (
dummyKey INTEGER NOT NULL,
a001 TINYINT,
a010 TINYINT,
a012 TINYINT,
a015 TINYINT,
a016 TINYINT,
a017 TINYINT,
a019 TINYINT,
a029 TINYINT,
a030 TINYINT,
a031 TINYINT,
a032 TINYINT,
a042 TINYINT,
a043 TINYINT,
a044 TINYINT,
a3001 TINYINT,
a3002 TINYINT,
a3003 TINYINT,
a3004 TINYINT,
a3005 TINYINT,
a3021 TINYINT,
a3022 TINYINT,
a BIT(6),
b BIT(6),
c BIT(6),
d TINYINT,
e TINYINT,
f TINYINT,
g TINYINT,
h TINYINT,
i TINYINT,
j TINYINT,
k TINYINT,
l TINYINT,
m TINYINT,
n TINYINT,
o TINYINT,
a034 TINYINT,
PRIMARY KEY USING HASH (dummyKey) ) engine=ndb;
INSERT INTO `t1` VALUES
(1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000001',b'111111',b'111110',4,5,5,5,5,5,5,5,5,5,3,2,1),
(2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000010',b'000000',b'111101',4,5,5,5,5,5,5,5,5,5,3,2,1),
(3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000100',b'001111',b'111011',4,5,5,5,5,5,5,5,5,5,3,2,1),
(4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'001000',b'110000',b'110111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'010000',b'100001',b'101111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','?','>',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','\0','=',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','',';',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','0','7',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','!','/',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,' ','','',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'\0',' ','?',4,5,5,5,5,5,5,5,5,5,3,2,1);
INSERT INTO `t1` VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'?','\0','\0',4,5,5,5,5,5,5,5,5,5,3,2,1);
drop table t1;
create table t1 (
pk1 bit(9) not null primary key, pk1 bit(9) not null primary key,
b int b int
) engine=ndbcluster; ) engine=ndbcluster;
......
...@@ -786,3 +786,50 @@ END| ...@@ -786,3 +786,50 @@ END|
ERROR 0A000: HANDLER is not allowed in stored procedures ERROR 0A000: HANDLER is not allowed in stored procedures
SELECT bug12995()| SELECT bug12995()|
ERROR 42000: FUNCTION test.bug12995 does not exist ERROR 42000: FUNCTION test.bug12995 does not exist
drop procedure if exists bug12712;
drop function if exists bug12712;
create procedure bug12712()
set session autocommit = 0;
select @@autocommit;
@@autocommit
1
set @au = @@autocommit;
call bug12712();
select @@autocommit;
@@autocommit
0
set session autocommit = @au;
create function bug12712()
returns int
begin
call bug12712();
return 0;
end|
set @x = bug12712()|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
drop procedure bug12712|
drop function bug12712|
create function bug12712()
returns int
begin
set session autocommit = 0;
return 0;
end|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create function bug12712()
returns int
begin
set @@autocommit = 0;
return 0;
end|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create function bug12712()
returns int
begin
set local autocommit = 0;
return 0;
end|
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
create trigger bug12712
before insert on t1 for each row set session autocommit = 0;
ERROR HY000: Not allowed to set autocommit from a stored function or trigger
...@@ -3323,6 +3323,7 @@ drop function bug12379| ...@@ -3323,6 +3323,7 @@ drop function bug12379|
drop procedure bug12379_1| drop procedure bug12379_1|
drop procedure bug12379_2| drop procedure bug12379_2|
drop procedure bug12379_3| drop procedure bug12379_3|
drop table t3|
drop procedure if exists bug13124| drop procedure if exists bug13124|
create procedure bug13124() create procedure bug13124()
begin begin
...@@ -3331,4 +3332,20 @@ set @x=y; ...@@ -3331,4 +3332,20 @@ set @x=y;
end| end|
call bug13124()| call bug13124()|
drop procedure bug13124| drop procedure bug13124|
drop procedure if exists bug12979_1|
create procedure bug12979_1(inout d decimal(5)) set d = d / 2|
set @bug12979_user_var = NULL|
call bug12979_1(@bug12979_user_var)|
drop procedure bug12979_1|
drop procedure if exists bug12979_2|
create procedure bug12979_2()
begin
declare internal_var decimal(5);
set internal_var= internal_var / 2;
select internal_var;
end|
call bug12979_2()|
internal_var
NULL
drop procedure bug12979_2|
drop table t1,t2; drop table t1,t2;
...@@ -1016,3 +1016,6 @@ v tdec ...@@ -1016,3 +1016,6 @@ v tdec
v tdec v tdec
9 0 9 0
drop procedure wg2; drop procedure wg2;
select cast(@non_existing_user_var/2 as DECIMAL);
cast(@non_existing_user_var/2 as DECIMAL)
NULL
...@@ -338,7 +338,7 @@ from information_schema.tables ...@@ -338,7 +338,7 @@ from information_schema.tables
where table_schema='information_schema' limit 2; where table_schema='information_schema' limit 2;
show tables from information_schema like "T%"; show tables from information_schema like "T%";
--error 1007 --error 1044
create database information_schema; create database information_schema;
use information_schema; use information_schema;
show full tables like "T%"; show full tables like "T%";
...@@ -678,3 +678,39 @@ show fields from test.v1; ...@@ -678,3 +678,39 @@ show fields from test.v1;
connection default; connection default;
drop view v1; drop view v1;
drop table t1; drop table t1;
#
# Bug #9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'
#
--error 1044
alter database information_schema;
--error 1044
drop database information_schema;
--error 1044
drop table information_schema.tables;
--error 1044
alter table information_schema.tables;
#
# Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB
#
use information_schema;
--error 1044
create temporary table schemata(f1 char(10));
#
# Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
#
delimiter |;
--error 1044
CREATE PROCEDURE p1 ()
BEGIN
SELECT 'foo' FROM DUAL;
END |
delimiter ;|
select ROUTINE_NAME from routines;
#
# Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema
#
--error 1044
grant all on information_schema.* to 'user1'@'localhost';
--error 1044
grant select on information_schema.* to 'user1'@'localhost';
...@@ -47,6 +47,58 @@ select a+0 from t1 order by a; ...@@ -47,6 +47,58 @@ select a+0 from t1 order by a;
select b+0 from t1 order by b; select b+0 from t1 order by b;
drop table t1; drop table t1;
create table t1 (
dummyKey INTEGER NOT NULL,
a001 TINYINT,
a010 TINYINT,
a012 TINYINT,
a015 TINYINT,
a016 TINYINT,
a017 TINYINT,
a019 TINYINT,
a029 TINYINT,
a030 TINYINT,
a031 TINYINT,
a032 TINYINT,
a042 TINYINT,
a043 TINYINT,
a044 TINYINT,
a3001 TINYINT,
a3002 TINYINT,
a3003 TINYINT,
a3004 TINYINT,
a3005 TINYINT,
a3021 TINYINT,
a3022 TINYINT,
a BIT(6),
b BIT(6),
c BIT(6),
d TINYINT,
e TINYINT,
f TINYINT,
g TINYINT,
h TINYINT,
i TINYINT,
j TINYINT,
k TINYINT,
l TINYINT,
m TINYINT,
n TINYINT,
o TINYINT,
a034 TINYINT,
PRIMARY KEY USING HASH (dummyKey) ) engine=ndb;
INSERT INTO `t1` VALUES
(1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000001',b'111111',b'111110',4,5,5,5,5,5,5,5,5,5,3,2,1),
(2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000010',b'000000',b'111101',4,5,5,5,5,5,5,5,5,5,3,2,1),
(3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000100',b'001111',b'111011',4,5,5,5,5,5,5,5,5,5,3,2,1),
(4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'001000',b'110000',b'110111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'010000',b'100001',b'101111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
(8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test t1
drop table t1;
--error 1005 --error 1005
create table t1 ( create table t1 (
pk1 bit(9) not null primary key, pk1 bit(9) not null primary key,
......
...@@ -1130,6 +1130,64 @@ END| ...@@ -1130,6 +1130,64 @@ END|
SELECT bug12995()| SELECT bug12995()|
delimiter ;| delimiter ;|
#
# BUG#12712: SET AUTOCOMMIT should fail within SP/functions/triggers
#
--disable_warnings
drop procedure if exists bug12712;
drop function if exists bug12712;
--enable_warnings
# Can...
create procedure bug12712()
set session autocommit = 0;
select @@autocommit;
set @au = @@autocommit;
call bug12712();
select @@autocommit;
set session autocommit = @au;
delimiter |;
create function bug12712()
returns int
begin
call bug12712();
return 0;
end|
# Can't...
--error ER_SP_CANT_SET_AUTOCOMMIT
set @x = bug12712()|
drop procedure bug12712|
drop function bug12712|
--error ER_SP_CANT_SET_AUTOCOMMIT
create function bug12712()
returns int
begin
set session autocommit = 0;
return 0;
end|
--error ER_SP_CANT_SET_AUTOCOMMIT
create function bug12712()
returns int
begin
set @@autocommit = 0;
return 0;
end|
--error ER_SP_CANT_SET_AUTOCOMMIT
create function bug12712()
returns int
begin
set local autocommit = 0;
return 0;
end|
delimiter ;|
--error ER_SP_CANT_SET_AUTOCOMMIT
create trigger bug12712
before insert on t1 for each row set session autocommit = 0;
# #
# BUG#NNNN: New bug synopsis # BUG#NNNN: New bug synopsis
# #
......
...@@ -4161,6 +4161,7 @@ drop function bug12379| ...@@ -4161,6 +4161,7 @@ drop function bug12379|
drop procedure bug12379_1| drop procedure bug12379_1|
drop procedure bug12379_2| drop procedure bug12379_2|
drop procedure bug12379_3| drop procedure bug12379_3|
drop table t3|
# #
# Bug #13124 Stored Procedure using SELECT INTO crashes server # Bug #13124 Stored Procedure using SELECT INTO crashes server
...@@ -4177,6 +4178,35 @@ end| ...@@ -4177,6 +4178,35 @@ end|
call bug13124()| call bug13124()|
drop procedure bug13124| drop procedure bug13124|
#
# Bug #12979 Stored procedures: crash if inout decimal parameter
#
# check NULL inout parameters processing
--disable_warnings
drop procedure if exists bug12979_1|
--enable_warnings
create procedure bug12979_1(inout d decimal(5)) set d = d / 2|
set @bug12979_user_var = NULL|
call bug12979_1(@bug12979_user_var)|
drop procedure bug12979_1|
# check NULL local variables processing
--disable_warnings
drop procedure if exists bug12979_2|
--enable_warnings
create procedure bug12979_2()
begin
declare internal_var decimal(5);
set internal_var= internal_var / 2;
select internal_var;
end|
call bug12979_2()|
drop procedure bug12979_2|
# #
# BUG#NNNN: New bug synopsis # BUG#NNNN: New bug synopsis
# #
......
...@@ -1037,3 +1037,10 @@ call wg2()// ...@@ -1037,3 +1037,10 @@ call wg2()//
delimiter ;// delimiter ;//
drop procedure wg2; drop procedure wg2;
#
# Bug #12979 Stored procedures: crash if inout decimal parameter
# (not a SP bug in fact)
#
select cast(@non_existing_user_var/2 as DECIMAL);
...@@ -765,7 +765,7 @@ my_decimal *Item_func_numhybrid::val_decimal(my_decimal *decimal_value) ...@@ -765,7 +765,7 @@ my_decimal *Item_func_numhybrid::val_decimal(my_decimal *decimal_value)
} }
case REAL_RESULT: case REAL_RESULT:
{ {
double result= (double)int_op(); double result= (double)real_op();
double2my_decimal(E_DEC_FATAL_ERROR, result, decimal_value); double2my_decimal(E_DEC_FATAL_ERROR, result, decimal_value);
break; break;
} }
......
...@@ -628,7 +628,7 @@ void close_connection(THD *thd, uint errcode, bool lock); ...@@ -628,7 +628,7 @@ void close_connection(THD *thd, uint errcode, bool lock);
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
bool *write_to_binlog); bool *write_to_binlog);
bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv, bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
bool no_grant, bool no_errors); bool no_grant, bool no_errors, bool schema_db);
bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables, bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
bool no_errors); bool no_errors);
bool check_global_access(THD *thd, ulong want_access); bool check_global_access(THD *thd, ulong want_access);
...@@ -875,6 +875,8 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond); ...@@ -875,6 +875,8 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
bool get_schema_tables_result(JOIN *join); bool get_schema_tables_result(JOIN *join);
#define is_schema_db(X) \
!my_strcasecmp(system_charset_info, information_schema_name.str, (X))
/* sql_prepare.cc */ /* sql_prepare.cc */
......
...@@ -163,7 +163,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) ...@@ -163,7 +163,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
SLAVE_INFO *si; SLAVE_INFO *si;
uchar *p= packet, *p_end= packet + packet_length; uchar *p= packet, *p_end= packet + packet_length;
if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0)) if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0,0))
return 1; return 1;
if (!(si = (SLAVE_INFO*)my_malloc(sizeof(SLAVE_INFO), MYF(MY_WME)))) if (!(si = (SLAVE_INFO*)my_malloc(sizeof(SLAVE_INFO), MYF(MY_WME))))
goto err2; goto err2;
......
...@@ -449,7 +449,7 @@ sys_var_thd_date_time_format sys_datetime_format("datetime_format", ...@@ -449,7 +449,7 @@ sys_var_thd_date_time_format sys_datetime_format("datetime_format",
/* Variables that are bits in THD */ /* Variables that are bits in THD */
static sys_var_thd_bit sys_autocommit("autocommit", 0, sys_var_thd_bit sys_autocommit("autocommit", 0,
set_option_autocommit, set_option_autocommit,
OPTION_NOT_AUTOCOMMIT, OPTION_NOT_AUTOCOMMIT,
1); 1);
......
...@@ -906,6 +906,7 @@ extern sys_var_const_str sys_charset_system; ...@@ -906,6 +906,7 @@ extern sys_var_const_str sys_charset_system;
extern sys_var_str sys_init_connect; extern sys_var_str sys_init_connect;
extern sys_var_str sys_init_slave; extern sys_var_str sys_init_slave;
extern sys_var_thd_time_zone sys_time_zone; extern sys_var_thd_time_zone sys_time_zone;
extern sys_var_thd_bit sys_autocommit;
CHARSET_INFO *get_old_charset_by_name(const char *old_name); CHARSET_INFO *get_old_charset_by_name(const char *old_name);
gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length, gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
NAMED_LIST **found); NAMED_LIST **found);
......
...@@ -5403,6 +5403,8 @@ ER_VIEW_PREVENT_UPDATE ...@@ -5403,6 +5403,8 @@ ER_VIEW_PREVENT_UPDATE
eng "The definition of table '%-.64s' prevents operation %s on table '%-.64s'." eng "The definition of table '%-.64s' prevents operation %s on table '%-.64s'."
ER_PS_NO_RECURSION ER_PS_NO_RECURSION
eng "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner" eng "The prepared statement contains a stored routine call that refers to that same statement. It's not allowed to execute a prepared statement in such a recursive manner"
ER_SP_CANT_SET_AUTOCOMMIT
eng "Not allowed to set autocommit from a stored function or trigger"
ER_PARTITION_REQUIRES_VALUES_ERROR ER_PARTITION_REQUIRES_VALUES_ERROR
eng "%s PARTITIONING requires definition of VALUES %s for each partition" eng "%s PARTITIONING requires definition of VALUES %s for each partition"
swe "%s PARTITIONering krver definition av VALUES %s fr varje partition" swe "%s PARTITIONering krver definition av VALUES %s fr varje partition"
......
...@@ -114,7 +114,8 @@ public: ...@@ -114,7 +114,8 @@ public:
IN_HANDLER= 4, // Is set if the parser is in a handler body IN_HANDLER= 4, // Is set if the parser is in a handler body
MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s) MULTI_RESULTS= 8, // Is set if a procedure with SELECT(s)
CONTAINS_DYNAMIC_SQL= 16, // Is set if a procedure with PREPARE/EXECUTE CONTAINS_DYNAMIC_SQL= 16, // Is set if a procedure with PREPARE/EXECUTE
IS_INVOKED= 32 // Is set if this sp_head is being used. IS_INVOKED= 32, // Is set if this sp_head is being used
HAS_SET_AUTOCOMMIT_STMT = 64 // Is set if a procedure with 'set autocommit'
}; };
int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE
...@@ -282,7 +283,10 @@ public: ...@@ -282,7 +283,10 @@ public:
my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "Dynamic SQL"); my_error(ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0), "Dynamic SQL");
else if (m_flags & MULTI_RESULTS) else if (m_flags & MULTI_RESULTS)
my_error(ER_SP_NO_RETSET, MYF(0), where); my_error(ER_SP_NO_RETSET, MYF(0), where);
return test(m_flags & (CONTAINS_DYNAMIC_SQL|MULTI_RESULTS)); else if (m_flags & HAS_SET_AUTOCOMMIT_STMT)
my_error(ER_SP_CANT_SET_AUTOCOMMIT, MYF(0));
return test(m_flags &
(CONTAINS_DYNAMIC_SQL|MULTI_RESULTS|HAS_SET_AUTOCOMMIT_STMT));
} }
private: private:
......
...@@ -1336,7 +1336,7 @@ bool check_change_password(THD *thd, const char *host, const char *user, ...@@ -1336,7 +1336,7 @@ bool check_change_password(THD *thd, const char *host, const char *user,
(strcmp(thd->user,user) || (strcmp(thd->user,user) ||
my_strcasecmp(system_charset_info, host, thd->priv_host))) my_strcasecmp(system_charset_info, host, thd->priv_host)))
{ {
if (check_access(thd, UPDATE_ACL, "mysql",0,1,0)) if (check_access(thd, UPDATE_ACL, "mysql",0,1,0,0))
return(1); return(1);
} }
if (!thd->slave_thread && !thd->user[0]) if (!thd->slave_thread && !thd->user[0])
...@@ -5533,7 +5533,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -5533,7 +5533,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
ulong want_access; ulong want_access;
char buff[100]; char buff[100];
TABLE *table= tables->table; TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0);
char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%";
DBUG_ENTER("fill_schema_user_privileges"); DBUG_ENTER("fill_schema_user_privileges");
...@@ -5586,7 +5586,7 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -5586,7 +5586,7 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
ulong want_access; ulong want_access;
char buff[100]; char buff[100];
TABLE *table= tables->table; TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0);
char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%";
DBUG_ENTER("fill_schema_schema_privileges"); DBUG_ENTER("fill_schema_schema_privileges");
...@@ -5641,7 +5641,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -5641,7 +5641,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
uint index; uint index;
char buff[100]; char buff[100];
TABLE *table= tables->table; TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0);
char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%";
DBUG_ENTER("fill_schema_table_privileges"); DBUG_ENTER("fill_schema_table_privileges");
...@@ -5703,7 +5703,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -5703,7 +5703,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
uint index; uint index;
char buff[100]; char buff[100];
TABLE *table= tables->table; TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0);
char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%";
DBUG_ENTER("fill_schema_table_privileges"); DBUG_ENTER("fill_schema_table_privileges");
......
This diff is collapsed.
...@@ -1235,7 +1235,7 @@ static int mysql_test_select(Prepared_statement *stmt, ...@@ -1235,7 +1235,7 @@ static int mysql_test_select(Prepared_statement *stmt,
if (check_table_access(thd, privilege, tables,0)) if (check_table_access(thd, privilege, tables,0))
goto error; goto error;
} }
else if (check_access(thd, privilege, any_db,0,0,0)) else if (check_access(thd, privilege, any_db,0,0,0,0))
goto error; goto error;
#endif #endif
......
...@@ -770,7 +770,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report) ...@@ -770,7 +770,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
int thread_mask; int thread_mask;
DBUG_ENTER("start_slave"); DBUG_ENTER("start_slave");
if (check_access(thd, SUPER_ACL, any_db,0,0,0)) if (check_access(thd, SUPER_ACL, any_db,0,0,0,0))
DBUG_RETURN(1); DBUG_RETURN(1);
lock_slave_threads(mi); // this allows us to cleanly read slave_running lock_slave_threads(mi); // this allows us to cleanly read slave_running
// Get a mask of _stopped_ threads // Get a mask of _stopped_ threads
...@@ -895,7 +895,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report ) ...@@ -895,7 +895,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
if (!thd) if (!thd)
thd = current_thd; thd = current_thd;
if (check_access(thd, SUPER_ACL, any_db,0,0,0)) if (check_access(thd, SUPER_ACL, any_db,0,0,0,0))
return 1; return 1;
thd->proc_info = "Killing slave"; thd->proc_info = "Killing slave";
int thread_mask; int thread_mask;
......
...@@ -2063,8 +2063,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2063,8 +2063,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
(base_name= select_lex->db) && !bases.elements)) (base_name= select_lex->db) && !bases.elements))
{ {
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
if (with_i_schema || // don't check the rights if information schema db if (!check_access(thd,SELECT_ACL, base_name,
!check_access(thd,SELECT_ACL, base_name, &thd->col_access,0,1) || &thd->col_access, 0, 1, with_i_schema) ||
thd->master_access & (DB_ACLS | SHOW_DB_ACL) || thd->master_access & (DB_ACLS | SHOW_DB_ACL) ||
acl_get(thd->host, thd->ip, thd->priv_user, base_name,0) || acl_get(thd->host, thd->ip, thd->priv_user, base_name,0) ||
(grant_option && !check_grant_db(thd, base_name))) (grant_option && !check_grant_db(thd, base_name)))
...@@ -2486,7 +2486,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, ...@@ -2486,7 +2486,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access; uint col_access;
check_access(thd,SELECT_ACL | EXTRA_ACL, base_name, check_access(thd,SELECT_ACL | EXTRA_ACL, base_name,
&tables->grant.privilege, 0, 0); &tables->grant.privilege, 0, 0, test(tables->schema_table));
col_access= get_column_grant(thd, &tables->grant, col_access= get_column_grant(thd, &tables->grant,
base_name, file_name, base_name, file_name,
field->field_name) & COL_ACLS; field->field_name) & COL_ACLS;
...@@ -2502,11 +2502,6 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, ...@@ -2502,11 +2502,6 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
end=strmov(end,grant_types.type_names[bitnr]); end=strmov(end,grant_types.type_names[bitnr]);
} }
} }
if (tables->schema_table) // any user has 'select' privilege on all
// I_S table columns
table->field[17]->store(grant_types.type_names[0],
strlen(grant_types.type_names[0]), cs);
else
table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs); table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs);
#endif #endif
......
...@@ -825,7 +825,8 @@ bool mysql_multi_update_prepare(THD *thd) ...@@ -825,7 +825,8 @@ bool mysql_multi_update_prepare(THD *thd)
{ {
uint want_privilege= tl->updating ? UPDATE_ACL : SELECT_ACL; uint want_privilege= tl->updating ? UPDATE_ACL : SELECT_ACL;
if (check_access(thd, want_privilege, if (check_access(thd, want_privilege,
tl->db, &tl->grant.privilege, 0, 0) || tl->db, &tl->grant.privilege, 0, 0,
test(tl->schema_table)) ||
(grant_option && check_grant(thd, want_privilege, tl, 0, 1, 0))) (grant_option && check_grant(thd, want_privilege, tl, 0, 1, 0)))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
......
...@@ -224,11 +224,11 @@ bool mysql_create_view(THD *thd, ...@@ -224,11 +224,11 @@ bool mysql_create_view(THD *thd,
table (i.e. user will not get some privileges by view creation) table (i.e. user will not get some privileges by view creation)
*/ */
if ((check_access(thd, CREATE_VIEW_ACL, view->db, &view->grant.privilege, if ((check_access(thd, CREATE_VIEW_ACL, view->db, &view->grant.privilege,
0, 0) || 0, 0, is_schema_db(view->db)) ||
grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0)) || grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0)) ||
(mode != VIEW_CREATE_NEW && (mode != VIEW_CREATE_NEW &&
(check_access(thd, DROP_ACL, view->db, &view->grant.privilege, (check_access(thd, DROP_ACL, view->db, &view->grant.privilege,
0, 0) || 0, 0, is_schema_db(view->db)) ||
grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0)))) grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0))))
{ {
res= TRUE; res= TRUE;
...@@ -280,7 +280,7 @@ bool mysql_create_view(THD *thd, ...@@ -280,7 +280,7 @@ bool mysql_create_view(THD *thd,
if (!tbl->table_in_first_from_clause) if (!tbl->table_in_first_from_clause)
{ {
if (check_access(thd, SELECT_ACL, tbl->db, if (check_access(thd, SELECT_ACL, tbl->db,
&tbl->grant.privilege, 0, 0) || &tbl->grant.privilege, 0, 0, test(tbl->schema_table)) ||
grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0)) grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0))
{ {
res= TRUE; res= TRUE;
......
...@@ -8603,6 +8603,14 @@ internal_variable_name: ...@@ -8603,6 +8603,14 @@ internal_variable_name:
if (tmp == &sys_time_zone && if (tmp == &sys_time_zone &&
lex->add_time_zone_tables_to_query_tables(YYTHD)) lex->add_time_zone_tables_to_query_tables(YYTHD))
YYABORT; YYABORT;
else if (spc && tmp == &sys_autocommit)
{
/*
We don't allow setting AUTOCOMMIT from a stored function
or trigger.
*/
lex->sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT;
}
} }
else else
{ {
......
...@@ -288,6 +288,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -288,6 +288,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
keynames=(char*) key_part; keynames=(char*) key_part;
strpos+= (strmov(keynames, (char *) strpos) - keynames)+1; strpos+= (strmov(keynames, (char *) strpos) - keynames)+1;
share->null_bytes= (null_pos-(uchar*)outparam->null_flags + (null_bit_pos + 7) / 8);
share->reclength = uint2korr((head+16)); share->reclength = uint2korr((head+16));
if (*(head+26) == 1) if (*(head+26) == 1)
share->system= 1; /* one-record-database */ share->system= 1; /* one-record-database */
......
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