Commit 4504e6d1 authored by Sergei Golubchik's avatar Sergei Golubchik

test cases for MySQL bugs

also fix a comment, and update a macro just in case
parent c9beef43
......@@ -36,8 +36,9 @@ extern const char *client_errors[]; /* Error messages */
#define CR_MIN_ERROR 2000 /* For easier client code */
#define CR_MAX_ERROR 2999
#if !defined(ER)
#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST)? \
client_errors[(X)-CR_ERROR_FIRST]: client_errors[CR_UNKNOWN_ERROR])
#define ER(X) (((X) >= CR_ERROR_FIRST && (X) <= CR_ERROR_LAST) \
? client_errors[(X)-CR_ERROR_FIRST] \
: client_errors[CR_UNKNOWN_ERROR-CR_ERROR_FIRST])
#endif
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
......
......@@ -91,3 +91,13 @@ select * from mysql.user where user = 'foo';
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time
% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 N N 0.000000
drop user foo;
#
# Bug #29882299: ALTER USER ... IDENTIFIED WITH ... BY ... SHOULD BE A PRIVILEGED OPERATION
#
create user foo@localhost;
connect x,localhost,foo;
alter user current_user identified with 'something';
ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
connection default;
disconnect x;
drop user foo@localhost;
......@@ -2425,5 +2425,12 @@ CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
INSERT INTO t1 () VALUES ();
DROP TABLE t1;
#
# Bug#33141958 - THE FIRST ASAN UAF ISSUE OF MYSQL SERVER
#
create table t1 (a int);
create trigger tr1 after insert on t1 for each row alter table t1 tablespace s2;
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
drop table t1;
#
# End of 10.2 tests
#
include/master-slave.inc
[connection master]
create table t1 (a int primary key, b int);
connection slave;
rename table t1 to t2;
create table t1 (a int primary key, b int) engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t2';
connection master;
insert t1 values (1,1),(2,2),(3,1);
delete from t1 where a=2;
connection slave;
select * from t1;
a b
1 1
3 1
drop table t2;
connection master;
drop table t1;
include/rpl_end.inc
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
create table t1 (a int primary key, b int);
sync_slave_with_master;
rename table t1 to t2;
evalp create table t1 (a int primary key, b int) engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t2';
connection master;
insert t1 values (1,1),(2,2),(3,1);
delete from t1 where a=2;
sync_slave_with_master;
select * from t1;
drop table t2;
connection master;
drop table t1;
source include/rpl_end.inc;
......@@ -34,3 +34,11 @@ select * from t8;
a b v
1234567890 2 2009-02-14 00:31:30
drop table t1, t3_ok, t8;
#
# Bug#33141966 - INCONSISTENT BEHAVIOR IF A COLUMN OF TYPE SERIAL IS SET AS GENERATED
#
create table t1 (a int, b serial as (a+1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'as (a+1))' at line 1
#
# End of 10.2 tests
#
......@@ -39,3 +39,13 @@ select * from t1;
select * from t8;
drop table t1, t3_ok, t8;
--echo #
--echo # Bug#33141966 - INCONSISTENT BEHAVIOR IF A COLUMN OF TYPE SERIAL IS SET AS GENERATED
--echo #
--error ER_PARSE_ERROR
create table t1 (a int, b serial as (a+1));
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -77,3 +77,14 @@ alter user foo with MAX_QUERIES_PER_HOUR 10
MAX_USER_CONNECTIONS 40;
select * from mysql.user where user = 'foo';
drop user foo;
--echo #
--echo # Bug #29882299: ALTER USER ... IDENTIFIED WITH ... BY ... SHOULD BE A PRIVILEGED OPERATION
--echo #
create user foo@localhost;
--connect x,localhost,foo
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
alter user current_user identified with 'something';
--connection default
--disconnect x
drop user foo@localhost;
......@@ -2757,6 +2757,14 @@ CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
INSERT INTO t1 () VALUES ();
DROP TABLE t1;
--echo #
--echo # Bug#33141958 - THE FIRST ASAN UAF ISSUE OF MYSQL SERVER
--echo #
create table t1 (a int);
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create trigger tr1 after insert on t1 for each row alter table t1 tablespace s2;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #
......@@ -2683,6 +2683,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
tmp_sctx->host_or_ip :
tmp_sctx->host ? tmp_sctx->host : "");
thd_info->command=(int) tmp->get_command();
/* Lock THD mutex that protects its data when looking at it. */
mysql_mutex_lock(&tmp->LOCK_thd_data);
if ((thd_info->db= tmp->db)) // Safe test
thd_info->db= thd->strdup(thd_info->db);
......@@ -2694,7 +2695,6 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if (mysys_var)
mysql_mutex_unlock(&mysys_var->mutex);
/* Lock THD mutex that protects its data when looking at it. */
if (tmp->query())
{
uint length= MY_MIN(max_query_length, tmp->query_length());
......
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