File: multi_table_io.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (55 lines) | stat: -rw-r--r-- 1,600 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Tests for PERFORMANCE_SCHEMA table io
#       Reveal that in case of statements using more than one base table
#       both show up in a correct way.

# Setup

--source include/not_embedded.inc
--source include/have_perfschema.inc

--disable_warnings
drop schema if exists test1;
drop table  if exists test.t1;
--enable_warnings

create schema test1;
let $engine_type= myisam;
eval create table test.t1 (col1 bigint, col2 varchar(30)) engine = $engine_type;
insert into test.t1 values(1,'One');
create table test1.t2 like test.t1;
# Make sure the proper engine is used
show create table test.t1;
show create table test1.t2;

--source ../include/table_io_setup_helper.inc
let $schema_to_dump= 'test','test1';

# Start event recording
update performance_schema.setup_consumers set enabled = 'YES';

--disable_ps2_protocol
# INSERT ... SELECT ...
insert into test1.t2 select * from test.t1;
insert into marker set a = 1;
# JOIN
select * from test.t1 natural join test1.t2;
insert into marker set a = 1;
# CORRELATED SUBQUERY
select * from test.t1 where col2 = (select col2 from test1.t2 where test.t1.col1 = test1.t2.col1);
insert into marker set a = 1;
# UPDATE
update test.t1 AS a natural join test1.t2 AS b SET a.col2 = 'updated' , b.col2 = 'updated';
insert into marker set a = 1;
# DELETE
delete from test.t1, test1.t2 using test.t1 inner join test1.t2
where test.t1.col1 = test1.t2.col1;
--enable_ps2_protocol

# Stop event recording + pull results
--source ../include/table_io_result_helper.inc

# Cleanup
drop table test.t1;
drop schema test1;
--source ../include/table_io_cleanup_helper.inc