1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-4879 - Merge test cases for new CREATE TEMPORARY TABLE privilege model

- merged test cases for MySQL bug#27480
- fixed that LOCK TABLES was unable to open temporary table
  (covered by grant2 test, merged appropriate code from 5.6)
- commented lines that cause server crash in merge test, reported
  MDEV-5042 (not relevant to bug#27480)
This commit is contained in:
Sergey Vojtovich
2013-09-20 13:12:53 +04:00
parent 8b5938a127
commit 815c607dcf
15 changed files with 1429 additions and 2 deletions

View File

@ -3826,3 +3826,90 @@ test.m1 repair error Corrupt
drop tables m1, t1, t4;
drop view t3;
End of 5.5 tests
#
# Additional coverage for refactoring which is made as part
# of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege
# to allow temp table operations".
#
# Check that prelocking works correctly for various variants of
# merge tables.
drop table if exists t1, t2, m1;
drop function if exists f1;
create table t1 (j int);
insert into t1 values (1);
create function f1() returns int return (select count(*) from m1);
create temporary table t2 (a int) engine=myisam;
insert into t2 values (1);
create temporary table m1 (a int) engine=merge union=(t2);
select f1() from t1;
f1()
1
drop tables t2, m1;
create table t2 (a int) engine=myisam;
insert into t2 values (1);
create table m1 (a int) engine=merge union=(t2);
select f1() from t1;
f1()
1
drop table m1;
create temporary table m1 (a int) engine=merge union=(t2);
select f1() from t1;
f1()
1
drop tables t1, t2, m1;
drop function f1;
#
# Check that REPAIR/CHECK and CHECKSUM statements work correctly
# for various variants of merge tables.
create table t1 (a int) engine=myisam;
insert into t1 values (1);
create table m1 (a int) engine=merge union=(t1);
check table m1;
Table Op Msg_type Msg_text
test.m1 check status OK
repair table m1;
Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
checksum table m1;
Table Checksum
test.m1 3459908756
drop tables t1, m1;
create temporary table t1 (a int) engine=myisam;
insert into t1 values (1);
create temporary table m1 (a int) engine=merge union=(t1);
check table m1;
Table Op Msg_type Msg_text
test.m1 check status OK
repair table m1;
Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
checksum table m1;
Table Checksum
test.m1 3459908756
drop tables t1, m1;
create table t1 (a int) engine=myisam;
insert into t1 values (1);
create temporary table m1 (a int) engine=merge union=(t1);
check table m1;
Table Op Msg_type Msg_text
test.m1 check status OK
repair table m1;
Table Op Msg_type Msg_text
test.m1 repair note The storage engine for the table doesn't support repair
checksum table m1;
Table Checksum
test.m1 3459908756
drop tables t1, m1;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS m1;
DROP TRIGGER IF EXISTS trg1;
DROP TABLE IF EXISTS q1;
DROP TABLE IF EXISTS q2;
CREATE TABLE t1(a INT);
CREATE TABLE m1(a INT) ENGINE = MERGE UNION (q1, q2);
CREATE TRIGGER trg1 BEFORE DELETE ON t1
FOR EACH ROW
INSERT INTO m1 VALUES (1);
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE m1;