diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index d56020c3090..61e9656e6ee 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1129,6 +1129,12 @@ DROP USER mysqltest_1@localhost; DROP DATABASE db27878; use test; DROP TABLE t1; +# +# Bug#33275 Server crash when creating temporary table mysql.user +# +CREATE TEMPORARY TABLE mysql.user (id INT); +FLUSH PRIVILEGES; +DROP TABLE mysql.user; drop table if exists test; Warnings: Note 1051 Unknown table 'test' diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index e4b95502143..55f046ffc33 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1153,6 +1153,12 @@ DROP DATABASE db27878; use test; DROP TABLE t1; +--echo # +--echo # Bug#33275 Server crash when creating temporary table mysql.user +--echo # +CREATE TEMPORARY TABLE mysql.user (id INT); +FLUSH PRIVILEGES; +DROP TABLE mysql.user; # # Bug #33201 Crash occurs when granting update privilege on one column of a view # diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index c446808c7da..481d72cf3fe 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -223,7 +223,7 @@ void my_thread_global_end(void) #endif } -static long thread_id=0; +static ulong thread_id=0; /* Allocate thread specific memory for the thread, used by mysys and dbug diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 7592986ef81..e10b339c97f 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -558,6 +558,8 @@ my_bool acl_reload(THD *thd) tables[0].next_local= tables[0].next_global= tables+1; tables[1].next_local= tables[1].next_global= tables+2; tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ; + tables[0].skip_temporary= tables[1].skip_temporary= + tables[2].skip_temporary= TRUE; if (simple_open_n_lock_tables(thd, tables)) { @@ -3537,7 +3539,8 @@ my_bool grant_reload(THD *thd) tables[0].next_local= tables[0].next_global= tables+1; tables[1].next_local= tables[1].next_global= tables+2; tables[0].lock_type= tables[1].lock_type= tables[2].lock_type= TL_READ; - + tables[0].skip_temporary= tables[1].skip_temporary= + tables[2].skip_temporary= TRUE; /* To avoid deadlocks we should obtain table locks before obtaining LOCK_grant rwlock.