1drop table if exists t1,t2;
2Warnings:
3Note	1051	Unknown table 'test.t1'
4Note	1051	Unknown table 'test.t2'
5CREATE TABLE t1 (i INT) ENGINE=Aria;
6CREATE TABLE t2 (i INT) ENGINE=Aria;
7LOCK TABLE t1 WRITE, t2 WRITE;
8DROP TABLE t1;
9UNLOCK TABLES;
10DROP TABLE t2;
11CREATE TABLE t1 (i INT) ENGINE=Aria;
12CREATE TABLE t2 (i INT) ENGINE=Aria;
13LOCK TABLE t1 WRITE, t2 WRITE;
14FLUSH TABLE t1;
15select * from t1;
16i
17unlock tables;
18drop table t1,t2;
19CREATE TABLE t1 (i INT) ENGINE=Aria;
20CREATE TABLE t2 (i INT) ENGINE=Aria;
21LOCK TABLE t1 WRITE, t2 WRITE;
22repair table t1 use_frm;
23Table	Op	Msg_type	Msg_text
24test.t1	repair	status	OK
25select * from t1;
26i
27drop table t2;
28unlock tables;
29drop table t1;
30CREATE TABLE t1 (i INT) ENGINE=Aria;
31LOCK TABLES t1 WRITE, t1 AS t1a WRITE;
32DROP TABLE t1;
33#
34#  MDEV-8200 aria bug with insert select when select is a aria table
35#  (wrong result or assertion failure:
36# `table->file->stats.records > 0 || error')
37#
38CREATE TABLE t1 (f1 INT) ENGINE=Aria;
39SHOW CREATE TABLE t1;
40Table	Create Table
41t1	CREATE TABLE `t1` (
42  `f1` int(11) DEFAULT NULL
43) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
44INSERT INTO t1 VALUES (1);
45CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
46CREATE TABLE tmp (f3 INT) engine=Aria;
47LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE;
48INSERT INTO tmp SELECT f1 FROM t1;
49INSERT INTO t2 SELECT f3 FROM tmp AS tmp_alias;
50select * from t2;
51f2
521
53unlock tables;
54DROP TABLE t1,t2,tmp;
55#
56# Same without transactional
57#
58CREATE TABLE t1 (f1 INT) transactional=0 ENGINE=Aria;
59SHOW CREATE TABLE t1;
60Table	Create Table
61t1	CREATE TABLE `t1` (
62  `f1` int(11) DEFAULT NULL
63) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=0
64INSERT INTO t1 VALUES (2);
65CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
66CREATE TABLE tmp (f3 INT) transactional=0 engine=Aria;
67LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE;
68INSERT INTO tmp SELECT f1 FROM t1;
69INSERT INTO t2 SELECT f3 FROM tmp AS tmp_alias;
70select * from t2;
71f2
722
73unlock tables;
74DROP TABLE t1,t2,tmp;
75#
76# Using spatical keys (disables versioning)
77#
78CREATE TABLE t1 (f1 INT, c1 geometry NOT NULL, SPATIAL KEY i1 (c1)) transactional=1 ENGINE=Aria;
79SHOW CREATE TABLE t1;
80Table	Create Table
81t1	CREATE TABLE `t1` (
82  `f1` int(11) DEFAULT NULL,
83  `c1` geometry NOT NULL,
84  SPATIAL KEY `i1` (`c1`)
85) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1
86INSERT INTO t1 VALUES (3,
87PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
88                          -18.6055555000 -66.8158332999,
89                          -18.7186111000 -66.8102777000,
90                          -18.7211111000 -66.9269443999,
91                          -18.6086111000 -66.9327777000))'));
92CREATE TABLE t2 (f2 INT) ENGINE=MyISAM;
93CREATE TABLE tmp (f3 INT, c1 geometry NOT NULL, SPATIAL KEY i1 (c1)) transactional=1 ENGINE=Aria;
94LOCK TABLE t2 WRITE, tmp WRITE, tmp AS tmp_alias WRITE, t1 WRITE;
95INSERT INTO tmp SELECT f1,c1 FROM t1;
96INSERT INTO t2 (f2) SELECT f3 FROM tmp AS tmp_alias;
97select * from t2;
98f2
993
100unlock tables;
101DROP TABLE t1,t2,tmp;
102#
103# MDEV-10378 Assertion `trn' failed in virtual int ha_maria::start_stmt
104#
105CREATE TABLE t1 (f1 VARCHAR(3), f2 INT, pk INT, PRIMARY KEY (pk)) ENGINE=Aria;
106INSERT INTO t1 VALUES  ('foo',10,1), ('foo',1,2);
107LOCK TABLE t1 WRITE;
108ALTER TABLE t1 ADD UNIQUE KEY (f1);
109ERROR 23000: Duplicate entry 'foo' for key 'f1'
110ALTER TABLE t1 ADD KEY (f2);
111DROP TABLE t1;
112#
113# MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
114#
115CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
116SELECT * FROM t1;
117a	b
118CREATE TABLE t2 (c INT) ENGINE=Aria;
119LOCK TABLE t2 READ, t1 WRITE;
120ALTER TABLE t1 CHANGE b a INT;
121ERROR 42S21: Duplicate column name 'a'
122UNLOCK TABLES;
123DROP TABLE t1, t2;
124#
125# MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
126#
127CREATE TABLE t1 (a INT) ENGINE=Aria;
128CREATE TABLE t2 (b INT) ENGINE=Aria;
129LOCK TABLES t1 WRITE, t2 AS t2a WRITE, t2 WRITE;
130ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
131UNLOCK TABLES;
132DROP TABLE t1, t2;
133# More complex test, from RQG
134CREATE TABLE t1 (a INT) ENGINE=Aria;
135CREATE TABLE t2 (b INT) ENGINE=Aria;
136CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2 ;
137LOCK TABLES t1 WRITE, t2 AS t2a WRITE, v2 WRITE CONCURRENT, t2 WRITE;
138ALTER TABLE t1 FORCE;
139ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=INPLACE;
140ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
141ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
142UNLOCK TABLES;
143DROP VIEW v2;
144DROP TABLE t1, t2;
145# End of 10.2 tests
146#
147# MDEV-14669 Assertion `file->trn == trn' failed in ha_maria::start_stmt
148#
149CREATE TABLE t1 (i INT) ENGINE=Aria;
150INSERT INTO t1 VALUES (1),(2);
151CREATE TABLE t2 (c CHAR(1)) ENGINE=Aria;
152INSERT INTO t2 VALUES ('a'),('b');
153connect  con1,localhost,root,,test;
154LOCK TABLE t1 WRITE;
155OPTIMIZE TABLE t1;
156Table	Op	Msg_type	Msg_text
157test.t1	optimize	status	OK
158connection default;
159DELETE FROM t2 WHERE c < 1;
160Warnings:
161Warning	1292	Truncated incorrect DOUBLE value: 'a'
162Warning	1292	Truncated incorrect DOUBLE value: 'b'
163connection con1;
164OPTIMIZE TABLE t1;
165Table	Op	Msg_type	Msg_text
166test.t1	optimize	status	Table is already up to date
167disconnect con1;
168connection default;
169DROP TABLE t1, t2;
170