/usr/lib/mysql-testsuite/r/ps_ddl1.result is in percona-server-test-5.6 5.6.22-rel71.0-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | drop temporary table if exists t1;
drop table if exists t1, t2;
drop procedure if exists p_verify_reprepare_count;
drop procedure if exists p1;
drop function if exists f1;
drop view if exists t1;
drop schema if exists mysqltest;
create procedure p_verify_reprepare_count(expected int)
begin
declare old_reprepare_count int default @reprepare_count;
select variable_value from
information_schema.session_status where
variable_name='com_stmt_reprepare'
into @reprepare_count;
if old_reprepare_count + expected <> @reprepare_count then
select concat("Expected: ", expected,
", actual: ", @reprepare_count - old_reprepare_count)
as "ERROR";
else
select '' as "SUCCESS";
end if;
end|
set @reprepare_count= 0;
flush status;
drop table if exists t1;
# Column added or dropped is not within the list of selected columns
# or table comment has changed.
# A reprepare is probably not needed.
create table t1 (a int, b int);
prepare stmt from "select a from t1";
execute stmt;
a
call p_verify_reprepare_count(0);
SUCCESS
alter table t1 add column c int;
execute stmt;
a
call p_verify_reprepare_count(1);
SUCCESS
execute stmt;
a
call p_verify_reprepare_count(0);
SUCCESS
alter table t1 drop column b;
execute stmt;
a
call p_verify_reprepare_count(1);
SUCCESS
execute stmt;
a
call p_verify_reprepare_count(0);
SUCCESS
alter table t1 comment "My best table";
execute stmt;
a
call p_verify_reprepare_count(1);
SUCCESS
execute stmt;
a
call p_verify_reprepare_count(0);
SUCCESS
drop table t1;
deallocate prepare stmt;
# Selects using the table at various positions, inser,update ...
# + the table disappears
create table t1 (a int);
prepare stmt1 from "truncate t1";
prepare stmt2 from "select 1 as my_column from t1";
prepare stmt3 from "select 1 as my_column from (select * from t1) as t2";
prepare stmt4 from
"select 1 as my_column from (select 1) as t2 where exists (select 1 from t1)";
prepare stmt5 from "select * from (select 1 as b) as t2, t1";
prepare stmt6 from "select * from t1 union all select 1.5";
prepare stmt7 from "select 1 as my_column union all select 1 from t1";
prepare stmt8 from "insert into t1 values(1),(2)";
prepare stmt9 from "update t1 set a = 3 where a = 2";
prepare stmt10 from "delete from t1 where a = 1";
# Attention: Result logging is disabled.
execute stmt10;
execute stmt9;
execute stmt8;
execute stmt7;
execute stmt6;
execute stmt5;
execute stmt4;
execute stmt3;
execute stmt2;
execute stmt1;
call p_verify_reprepare_count(0);
SUCCESS
drop table t1;
execute stmt10;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt9;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt8;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt7;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt6;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt5;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt4;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt3;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt2;
ERROR 42S02: Table 'test.t1' doesn't exist
execute stmt1;
ERROR 42S02: Table 'test.t1' doesn't exist
call p_verify_reprepare_count(0);
SUCCESS
deallocate prepare stmt10;
deallocate prepare stmt9;
deallocate prepare stmt8;
deallocate prepare stmt7;
deallocate prepare stmt6;
deallocate prepare stmt5;
deallocate prepare stmt4;
deallocate prepare stmt3;
deallocate prepare stmt2;
deallocate prepare stmt1;
# Selects using the table at various positions, inser,update ...
# + layout change (drop column) which must cause a reprepare
create table t1 (a int, b int);
insert into t1 values(1,1),(2,2),(3,3);
create table t2 like t1;
insert into t1 values(2,2);
prepare stmt1 from "select a,b from t1";
prepare stmt2 from "select a,b from (select * from t1) as t1";
prepare stmt3 from "select * from t1 where a = 2 and b = 2";
prepare stmt4 from "select * from t2 where (a,b) in (select * from t1)";
prepare stmt5 from "select * from t1 union select * from t2";
prepare stmt6 from "select * from t1 union all select * from t2";
prepare stmt7 from "insert into t1 set a = 4, b = 4";
prepare stmt8 from "insert into t1 select * from t2";
# Attention: Result logging is disabled.
execute stmt8;
execute stmt7;
execute stmt6;
execute stmt5;
execute stmt4;
execute stmt3;
execute stmt2;
execute stmt1;
call p_verify_reprepare_count(0);
SUCCESS
alter table t1 drop column b;
execute stmt8;
ERROR 21S01: Column count doesn't match value count at row 1
call p_verify_reprepare_count(1);
SUCCESS
execute stmt7;
ERROR 42S22: Unknown column 'b' in 'field list'
call p_verify_reprepare_count(1);
SUCCESS
execute stmt6;
ERROR 21000: The used SELECT statements have a different number of columns
call p_verify_reprepare_count(1);
SUCCESS
execute stmt5;
ERROR 21000: The used SELECT statements have a different number of columns
call p_verify_reprepare_count(1);
SUCCESS
execute stmt4;
ERROR 21000: Operand should contain 2 column(s)
call p_verify_reprepare_count(1);
SUCCESS
execute stmt3;
ERROR 42S22: Unknown column 'b' in 'where clause'
call p_verify_reprepare_count(1);
SUCCESS
execute stmt2;
ERROR 42S22: Unknown column 'b' in 'field list'
call p_verify_reprepare_count(1);
SUCCESS
execute stmt1;
ERROR 42S22: Unknown column 'b' in 'field list'
call p_verify_reprepare_count(1);
SUCCESS
execute stmt8;
ERROR 21S01: Column count doesn't match value count at row 1
call p_verify_reprepare_count(1);
SUCCESS
execute stmt7;
ERROR 42S22: Unknown column 'b' in 'field list'
call p_verify_reprepare_count(1);
SUCCESS
execute stmt6;
ERROR 21000: The used SELECT statements have a different number of columns
call p_verify_reprepare_count(1);
SUCCESS
execute stmt5;
ERROR 21000: The used SELECT statements have a different number of columns
call p_verify_reprepare_count(1);
SUCCESS
execute stmt4;
ERROR 21000: Operand should contain 2 column(s)
call p_verify_reprepare_count(1);
SUCCESS
execute stmt3;
ERROR 42S22: Unknown column 'b' in 'where clause'
call p_verify_reprepare_count(1);
SUCCESS
execute stmt2;
ERROR 42S22: Unknown column 'b' in 'field list'
call p_verify_reprepare_count(1);
SUCCESS
execute stmt1;
ERROR 42S22: Unknown column 'b' in 'field list'
call p_verify_reprepare_count(1);
SUCCESS
execute stmt8;
ERROR 21S01: Column count doesn't match value count at row 1
call p_verify_reprepare_count(1);
SUCCESS
alter table t2 add column c int;
execute stmt8;
ERROR 21S01: Column count doesn't match value count at row 1
call p_verify_reprepare_count(1);
SUCCESS
deallocate prepare stmt8;
deallocate prepare stmt7;
deallocate prepare stmt6;
deallocate prepare stmt5;
deallocate prepare stmt4;
deallocate prepare stmt3;
deallocate prepare stmt2;
deallocate prepare stmt1;
drop table t1;
drop table t2;
# select AVG(<col>) + optimizer uses index meets loss of the index
create table t1 (a int, b int, primary key(b),unique index t1_unq_idx(a));
insert into t1 set a = 0, b = 0;
insert into t1 select a + 1, b + 1 from t1;
insert into t1 select a + 2, b + 2 from t1;
insert into t1 select a + 4, b + 4 from t1;
insert into t1 select a + 8, b + 8 from t1;
# Optimizer strategy: Possible keys = NULL , Extra = Using index
prepare stmt from "select avg(a) from t1";
execute stmt;
avg(a)
7.5000
call p_verify_reprepare_count(0);
SUCCESS
execute stmt;
avg(a)
7.5000
call p_verify_reprepare_count(0);
SUCCESS
alter table t1 drop index t1_unq_idx;
# Optimizer strategy: Possible keys = NULL , Extra = NULL
execute stmt;
avg(a)
7.5000
call p_verify_reprepare_count(1);
SUCCESS
execute stmt;
avg(a)
7.5000
call p_verify_reprepare_count(0);
SUCCESS
# select AVG(<col>) + optimizer uses table scan meets a new index
alter table t1 add unique index t1_unq_idx(a);
# Optimizer strategy: Possible keys = NULL , Extra = Using index
execute stmt;
avg(a)
7.5000
call p_verify_reprepare_count(1);
SUCCESS
execute stmt;
avg(a)
7.5000
call p_verify_reprepare_count(0);
SUCCESS
deallocate prepare stmt;
drop table t1;
# table replaced by not updatable view - Insert
create table t1 (a int);
prepare stmt from "insert into t1 values(1)";
execute stmt;
call p_verify_reprepare_count(0);
SUCCESS
drop table t1;
create view t1 as select 1;
execute stmt;
ERROR HY000: The target table t1 of the INSERT is not insertable-into
call p_verify_reprepare_count(1);
SUCCESS
drop view t1;
create table t2 (a int);
create view t1 as select * from t2 with check option;
execute stmt;
call p_verify_reprepare_count(1);
SUCCESS
execute stmt;
call p_verify_reprepare_count(0);
SUCCESS
select * from t1;
a
1
1
deallocate prepare stmt;
drop view t1;
drop table t2;
=====================================================================
Some freestyle tests
=====================================================================
create temporary table t1 as select 1 as a;
create procedure p1()
begin
drop temporary table t1;
end|
create function f1() returns int
begin
call p1();
return 1;
end|
prepare stmt from "select f1() as my_column, a from t1";
execute stmt;
ERROR HY000: Can't reopen table: 't1'
call p_verify_reprepare_count(0);
SUCCESS
select * from t1;
a
1
prepare stmt from "select a, f1() as my_column from t1";
execute stmt;
ERROR HY000: Can't reopen table: 't1'
call p_verify_reprepare_count(0);
SUCCESS
select * from t1;
a
1
prepare stmt from "select f1() as my_column, count(*) from t1";
execute stmt;
ERROR HY000: Can't reopen table: 't1'
call p_verify_reprepare_count(0);
SUCCESS
select * from t1;
a
1
prepare stmt from "select count(*), f1() as my_column from t1";
execute stmt;
ERROR HY000: Can't reopen table: 't1'
call p_verify_reprepare_count(0);
SUCCESS
select * from t1;
a
1
# Execute fails, no drop of temporary table
prepare stmt from "select 1 as my_column from (select 1) as t2
where exists (select f1() from t1)";
execute stmt;
my_column
1
call p_verify_reprepare_count(0);
SUCCESS
execute stmt;
my_column
1
call p_verify_reprepare_count(0);
SUCCESS
select * from t1;
a
1
# Execute drops temporary table
prepare stmt from "select f1()";
execute stmt;
f1()
1
call p_verify_reprepare_count(0);
SUCCESS
execute stmt;
ERROR 42S02: Unknown table 'test.t1'
call p_verify_reprepare_count(0);
SUCCESS
drop function f1;
drop procedure p1;
deallocate prepare stmt;
# Execute fails, temporary table is not replaced by another
create temporary table t1 as select 1 as a;
create procedure p1()
begin
drop temporary table t1;
create temporary table t1 as select 'abc' as a;
end|
create function f1() returns int
begin
call p1();
return 1;
end|
prepare stmt from "select count(*), f1() as my_column from t1";
execute stmt;
ERROR HY000: Can't reopen table: 't1'
call p_verify_reprepare_count(0);
SUCCESS
select * from t1;
a
1
deallocate prepare stmt;
prepare stmt from "call p1";
execute stmt;
drop procedure p1;
create schema mysqltest;
create procedure mysqltest.p1()
begin
drop schema mysqltest;
create schema mysqltest;
end|
execute stmt;
ERROR 42000: PROCEDURE test.p1 does not exist
call p_verify_reprepare_count(0);
SUCCESS
execute stmt;
ERROR 42000: PROCEDURE test.p1 does not exist
call p_verify_reprepare_count(0);
SUCCESS
deallocate prepare stmt;
drop schema mysqltest;
drop temporary table t1;
# Cleanup
#
drop temporary table if exists t1;
drop table if exists t1, t2;
drop procedure if exists p_verify_reprepare_count;
drop procedure if exists p1;
drop function if exists f1;
drop view if exists t1;
drop schema if exists mysqltest;
|