| 1 |
drop table if exists t1,t3,t4,t5; |
| 2 |
drop database if exists test_test; |
| 3 |
SET SESSION DEFAULT_STORAGE_ENGINE = MyISAM; |
| 4 |
drop table if exists t1,t3,t4,t5; |
| 5 |
create table t1 (a int, b char(10), key a using btree (a), key b using btree (a,b)); |
| 6 |
insert into t1 values |
| 7 |
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), |
| 8 |
(14,"aaa"),(16,"ccc"),(16,"xxx"), |
| 9 |
(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx"); |
| 10 |
handler t1 open; |
| 11 |
handler t1 read a=(SELECT 1); |
| 12 |
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 'SELECT 1)' at line 1 |
| 13 |
handler t1 read a=(1) FIRST; |
| 14 |
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 'FIRST' at line 1 |
| 15 |
handler t1 read a=(1) NEXT; |
| 16 |
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 'NEXT' at line 1 |
| 17 |
handler t1 read last; |
| 18 |
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 '' at line 1 |
| 19 |
handler t1 close; |
| 20 |
drop table t1; |
| 21 |
CREATE TABLE t1(a INT, PRIMARY KEY(a)); |
| 22 |
insert into t1 values(1),(2); |
| 23 |
handler t1 open; |
| 24 |
handler t1 read primary=(1); |
| 25 |
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 'primary=(1)' at line 1 |
| 26 |
handler t1 read `primary`=(1); |
| 27 |
a |
| 28 |
1 |
| 29 |
handler t1 close; |
| 30 |
drop table t1; |
| 31 |
create database test_test; |
| 32 |
use test_test; |
| 33 |
create table t1(table_id char(20), primary key (table_id)); |
| 34 |
insert into t1 values ('test_test.t1'); |
| 35 |
insert into t1 values (''); |
| 36 |
handler t1 open; |
| 37 |
handler t1 read first limit 9; |
| 38 |
table_id |
| 39 |
test_test.t1 |
| 40 |
|
| 41 |
create table t2(table_id char(20), primary key (table_id)); |
| 42 |
insert into t2 values ('test_test.t2'); |
| 43 |
insert into t2 values (''); |
| 44 |
handler t2 open; |
| 45 |
handler t2 read first limit 9; |
| 46 |
table_id |
| 47 |
test_test.t2 |
| 48 |
|
| 49 |
use test; |
| 50 |
create table t1(table_id char(20), primary key (table_id)); |
| 51 |
insert into t1 values ('test.t1'); |
| 52 |
insert into t1 values (''); |
| 53 |
handler t1 open; |
| 54 |
ERROR 42000: Not unique table/alias: 't1' |
| 55 |
use test; |
| 56 |
handler test.t1 read first limit 9; |
| 57 |
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 'read first limit 9' at line 1 |
| 58 |
handler test_test.t1 read first limit 9; |
| 59 |
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 'read first limit 9' at line 1 |
| 60 |
handler t1 read first limit 9; |
| 61 |
table_id |
| 62 |
test_test.t1 |
| 63 |
|
| 64 |
handler test_test.t2 read first limit 9; |
| 65 |
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 'read first limit 9' at line 1 |
| 66 |
handler t2 read first limit 9; |
| 67 |
table_id |
| 68 |
test_test.t2 |
| 69 |
|
| 70 |
handler test_test.t1 close; |
| 71 |
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 'close' at line 1 |
| 72 |
handler t1 close; |
| 73 |
drop table test_test.t1; |
| 74 |
handler test_test.t2 close; |
| 75 |
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 'close' at line 1 |
| 76 |
handler t2 close; |
| 77 |
drop table test_test.t2; |
| 78 |
drop database test_test; |
| 79 |
use test; |
| 80 |
handler test.t1 close; |
| 81 |
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 'close' at line 1 |
| 82 |
handler t1 close; |
| 83 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 84 |
drop table test.t1; |
| 85 |
create database test_test; |
| 86 |
use test_test; |
| 87 |
create table t1 (c1 char(20)); |
| 88 |
insert into t1 values ('test_test.t1'); |
| 89 |
create table t3 (c1 char(20)); |
| 90 |
insert into t3 values ('test_test.t3'); |
| 91 |
handler t1 open; |
| 92 |
handler t1 read first limit 9; |
| 93 |
c1 |
| 94 |
test_test.t1 |
| 95 |
handler t1 open h1; |
| 96 |
handler h1 read first limit 9; |
| 97 |
c1 |
| 98 |
test_test.t1 |
| 99 |
use test; |
| 100 |
create table t1 (c1 char(20)); |
| 101 |
create table t2 (c1 char(20)); |
| 102 |
create table t3 (c1 char(20)); |
| 103 |
insert into t1 values ('t1'); |
| 104 |
insert into t2 values ('t2'); |
| 105 |
insert into t3 values ('t3'); |
| 106 |
handler t1 open; |
| 107 |
ERROR 42000: Not unique table/alias: 't1' |
| 108 |
handler t2 open t1; |
| 109 |
ERROR 42000: Not unique table/alias: 't1' |
| 110 |
handler t3 open t1; |
| 111 |
ERROR 42000: Not unique table/alias: 't1' |
| 112 |
handler t1 read first limit 9; |
| 113 |
c1 |
| 114 |
test_test.t1 |
| 115 |
handler test.t1 close; |
| 116 |
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 'close' at line 1 |
| 117 |
handler test.t1 open h1; |
| 118 |
ERROR 42000: Not unique table/alias: 'h1' |
| 119 |
handler test_test.t1 open h1; |
| 120 |
ERROR 42000: Not unique table/alias: 'h1' |
| 121 |
handler test_test.t3 open h3; |
| 122 |
handler test.t1 open h2; |
| 123 |
handler t1 read first limit 9; |
| 124 |
c1 |
| 125 |
test_test.t1 |
| 126 |
handler h1 read first limit 9; |
| 127 |
c1 |
| 128 |
test_test.t1 |
| 129 |
handler h2 read first limit 9; |
| 130 |
c1 |
| 131 |
t1 |
| 132 |
handler h3 read first limit 9; |
| 133 |
c1 |
| 134 |
test_test.t3 |
| 135 |
handler h2 read first limit 9; |
| 136 |
c1 |
| 137 |
t1 |
| 138 |
handler test.h1 close; |
| 139 |
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 'close' at line 1 |
| 140 |
handler t1 close; |
| 141 |
handler h1 close; |
| 142 |
handler h2 close; |
| 143 |
handler t1 read first limit 9; |
| 144 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 145 |
handler h1 read first limit 9; |
| 146 |
ERROR 42S02: Unknown table 'h1' in HANDLER |
| 147 |
handler h2 read first limit 9; |
| 148 |
ERROR 42S02: Unknown table 'h2' in HANDLER |
| 149 |
handler h3 read first limit 9; |
| 150 |
c1 |
| 151 |
test_test.t3 |
| 152 |
handler h3 read first limit 9; |
| 153 |
c1 |
| 154 |
test_test.t3 |
| 155 |
use test_test; |
| 156 |
handler h3 read first limit 9; |
| 157 |
c1 |
| 158 |
test_test.t3 |
| 159 |
handler test.h3 read first limit 9; |
| 160 |
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 'read first limit 9' at line 1 |
| 161 |
handler h3 close; |
| 162 |
use test; |
| 163 |
drop table t3; |
| 164 |
drop table t2; |
| 165 |
drop table t1; |
| 166 |
drop database test_test; |
| 167 |
create table t1 (c1 int); |
| 168 |
create table t2 (c1 int); |
| 169 |
insert into t1 values (1); |
| 170 |
insert into t2 values (2); |
| 171 |
handler t1 open; |
| 172 |
handler t1 read first; |
| 173 |
c1 |
| 174 |
1 |
| 175 |
connect flush,localhost,root,,; |
| 176 |
connection flush; |
| 177 |
flush tables; |
| 178 |
flush table t1; |
| 179 |
connect waiter,localhost,root,,; |
| 180 |
connection waiter; |
| 181 |
connection default; |
| 182 |
handler t2 open; |
| 183 |
handler t2 read first; |
| 184 |
c1 |
| 185 |
2 |
| 186 |
handler t1 read next; |
| 187 |
c1 |
| 188 |
1 |
| 189 |
handler t1 close; |
| 190 |
handler t2 close; |
| 191 |
connection flush; |
| 192 |
connection default; |
| 193 |
drop table t1,t2; |
| 194 |
disconnect flush; |
| 195 |
drop table if exists t1, t0; |
| 196 |
create table t1 (c1 int); |
| 197 |
handler t1 open; |
| 198 |
handler t1 read first; |
| 199 |
c1 |
| 200 |
connect flush,localhost,root,,; |
| 201 |
connection flush; |
| 202 |
rename table t1 to t0; |
| 203 |
connection waiter; |
| 204 |
connection default; |
| 205 |
# |
| 206 |
# RENAME placed two pending locks and waits. |
| 207 |
# When HANDLER t0 OPEN does open_tables(), it calls |
| 208 |
# mysql_ha_flush(), which in turn closes the open HANDLER for t1. |
| 209 |
# RENAME TABLE gets unblocked. If it gets scheduled quickly |
| 210 |
# and manages to complete before open_tables() |
| 211 |
# of HANDLER t0 OPEN, open_tables() and therefore the whole |
| 212 |
# HANDLER t0 OPEN succeeds. Otherwise open_tables() |
| 213 |
# notices a pending or active exclusive metadata lock on t2 |
| 214 |
# and the whole HANDLER t0 OPEN fails with ER_LOCK_DEADLOCK |
| 215 |
# error. |
| 216 |
# |
| 217 |
handler t0 open; |
| 218 |
handler t0 close; |
| 219 |
connection flush; |
| 220 |
handler t1 read next; |
| 221 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 222 |
handler t1 close; |
| 223 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 224 |
connection default; |
| 225 |
drop table t0; |
| 226 |
connection flush; |
| 227 |
disconnect flush; |
| 228 |
connection waiter; |
| 229 |
disconnect waiter; |
| 230 |
connection default; |
| 231 |
create table t1 (a int); |
| 232 |
handler t1 open as t1_alias; |
| 233 |
drop table t1; |
| 234 |
create table t1 (a int); |
| 235 |
handler t1 open as t1_alias; |
| 236 |
flush tables; |
| 237 |
drop table t1; |
| 238 |
create table t1 (a int); |
| 239 |
handler t1 open as t1_alias; |
| 240 |
handler t1_alias close; |
| 241 |
drop table t1; |
| 242 |
create table t1 (a int); |
| 243 |
handler t1 open as t1_alias; |
| 244 |
handler t1_alias read first; |
| 245 |
a |
| 246 |
drop table t1; |
| 247 |
handler t1_alias read next; |
| 248 |
ERROR 42S02: Unknown table 't1_alias' in HANDLER |
| 249 |
create table t1 (a int, b char(1), key a (a), key b (a,b)); |
| 250 |
insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), |
| 251 |
(5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); |
| 252 |
handler t1 open; |
| 253 |
handler t1 read a first; |
| 254 |
a b |
| 255 |
0 a |
| 256 |
handler t1 read a next; |
| 257 |
a b |
| 258 |
1 b |
| 259 |
flush tables; |
| 260 |
handler t1 read a next; |
| 261 |
a b |
| 262 |
2 c |
| 263 |
flush tables t1; |
| 264 |
handler t1 read a next; |
| 265 |
a b |
| 266 |
0 a |
| 267 |
flush tables with read lock; |
| 268 |
handler t1 read a next; |
| 269 |
a b |
| 270 |
0 a |
| 271 |
unlock tables; |
| 272 |
drop table t1; |
| 273 |
handler t1 read a next; |
| 274 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 275 |
connect con1,localhost,root,,; |
| 276 |
connect con2,localhost,root,,; |
| 277 |
# Now test case which was reported originally but which no longer |
| 278 |
# triggers execution path which has caused the problem. |
| 279 |
connection default; |
| 280 |
create table t1 (a int not null); |
| 281 |
insert into t1 values (1); |
| 282 |
handler t1 open; |
| 283 |
connection con1; |
| 284 |
alter table t1 engine=csv; |
| 285 |
connection con2; |
| 286 |
connection default; |
| 287 |
# Since S metadata lock was already acquired at HANDLER OPEN time |
| 288 |
# and TL_READ lock requested by HANDLER READ is compatible with |
| 289 |
# ALTER's TL_WRITE_ALLOW_READ the below statement should succeed |
| 290 |
# without waiting. The old version of table should be used in it. |
| 291 |
handler t1 read next; |
| 292 |
a |
| 293 |
1 |
| 294 |
handler t1 close; |
| 295 |
connection con1; |
| 296 |
drop table t1; |
| 297 |
disconnect con1; |
| 298 |
connection con2; |
| 299 |
disconnect con2; |
| 300 |
connection default; |
| 301 |
USE information_schema; |
| 302 |
HANDLER COLUMNS OPEN; |
| 303 |
ERROR HY000: Incorrect usage of HANDLER OPEN and information_schema |
| 304 |
USE test; |
| 305 |
PREPARE h_r FROM 'HANDLER t1 READ `PRIMARY` LAST'; |
| 306 |
ERROR 42S02: Unknown table 't1' in HANDLER |
| 307 |
create view v as select 1; |
| 308 |
create temporary table v as select 2; |
| 309 |
handler v open; |
| 310 |
prepare stmt from 'create table if not exists v as select 3'; |
| 311 |
execute stmt; |
| 312 |
Warnings: |
| 313 |
Note 1050 Table 'v' already exists |
| 314 |
handler v read next; |
| 315 |
ERROR 42S02: Unknown table 'v' in HANDLER |
| 316 |
drop view v; |
| 317 |
# |
| 318 |
# 10.2 Test |
| 319 |
# |
| 320 |
# MDEV-20207: Assertion `! is_set()' failed in |
| 321 |
# Diagnostics_area::set_eof_status upon HANDLER READ |
| 322 |
# |
| 323 |
DROP TABLE IF EXISTS t1; |
| 324 |
Warnings: |
| 325 |
Note 1051 Unknown table 'test.t1' |
| 326 |
CREATE TABLE t1 (a POINT, KEY(a)); |
| 327 |
HANDLER t1 OPEN h; |
| 328 |
HANDLER h READ a = (0); |
| 329 |
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
| 330 |
HANDLER h CLOSE; |
| 331 |
DROP TABLE t1; |
| 332 |
# End of 10.2 Test |
| 333 |
# |
| 334 |
# MDEV-15813 ASAN use-after-poison in hp_hashnr upon |
| 335 |
# HANDLER READ on a versioned HEAP table |
| 336 |
# |
| 337 |
CREATE TABLE t1 (g GEOMETRY NOT NULL, SPATIAL gi(g)); |
| 338 |
INSERT INTO t1 VALUES (POINT(0,0)); |
| 339 |
HANDLER t1 OPEN AS h; |
| 340 |
HANDLER h READ `gi`= (10); |
| 341 |
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
| 342 |
HANDLER h READ `gi`> (10); |
| 343 |
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field |
| 344 |
HANDLER h CLOSE; |
| 345 |
DROP TABLE t1; |
| 346 |
CREATE TABLE t1 (w VARCHAR(100), FULLTEXT fk(w)); |
| 347 |
INSERT INTO t1 VALUES ('one two three'); |
| 348 |
HANDLER t1 OPEN AS h; |
| 349 |
HANDLER h READ `fk`= (10); |
| 350 |
ERROR HY000: FULLTEXT index `fk` does not support this operation |
| 351 |
HANDLER h READ `fk`> (10); |
| 352 |
ERROR HY000: FULLTEXT index `fk` does not support this operation |
| 353 |
HANDLER h CLOSE; |
| 354 |
DROP TABLE t1; |
| 355 |
# |
| 356 |
# MDEV-35082 HANDLER with FULLTEXT keys is not always rejected |
| 357 |
# |
| 358 |
create table t (a int primary key, v text not null, fulltext(v)); |
| 359 |
handler t open; |
| 360 |
handler t read v next; |
| 361 |
ERROR HY000: FULLTEXT index `v` does not support this operation |
| 362 |
drop table t; |
| 363 |
# End of 10.5 tests |