Skip to content

Commit a1b500f

Browse files
author
Alexander Nozdrin
committed
WL#4179: Stored programs: validation of stored program statements.
Briefly, that's the implementation of WL#4179. The idea is to remember the original query for SQL-statement within a Stored Programs and re-parse it when meta-data has changed.
1 parent 2007d50 commit a1b500f

18 files changed

+5455
-176
lines changed

mysql-test/r/optimizer_switch.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ CALL p1;
106106
f1
107107
ALTER TABLE t2 CHANGE COLUMN f1 my_column INT;
108108
CALL p1;
109-
ERROR 42S22: Unknown column 'f1' in 'where clause'
109+
f1
110110
DROP PROCEDURE p1;
111111
DROP TABLE t1, t2;
112112
SET SESSION optimizer_switch = 'default';

mysql-test/r/ps_ddl.result

+1-34
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,6 @@ drop function f1;
309309
deallocate prepare stmt;
310310
# Test 7-c: dependent VIEW has changed
311311
#
312-
# Note, this scenario is not functioning correctly, see
313-
# Bug#33255 Trigger using views and view ddl : corrupted triggers
314-
# and Bug #33000 Triggers do not detect changes in meta-data.
315312
#
316313
drop trigger t1_ai;
317314
create table t2 (a int unique);
@@ -330,9 +327,6 @@ a
330327
drop view v1;
331328
create view v1 as select a from t3;
332329
insert into t1 (a) values (6);
333-
ERROR 42S02: Table 'test.t2' doesn't exist
334-
flush table t1;
335-
insert into t1 (a) values (6);
336330
select * from t2;
337331
a
338332
5
@@ -355,41 +349,14 @@ a
355349
drop view v1;
356350
create view v1 as select a from t2;
357351
set @var=8;
358-
# View in the INSERT-statement in the trigger is still pointing to
359-
# table 't3', because the trigger hasn't noticed the change
360-
# in view definition. This will be fixed by WL#4179.
361-
#
362-
# The prepared INSERT-statement however does notice the change,
363-
# but repreparation of the main statement doesn't cause repreparation
364-
# of trigger statements.
365-
#
366-
# The following EXECUTE results in ER_NO_SUCH_TABLE (t3) error, because
367-
# pre-locking list of the prepared statement has been changed
368-
# (the prepared statement has noticed the meta-data change),
369-
# but the trigger still tries to deal with 't3', which is not opened.
370-
# That's why '8' is not inserted neither into 't2', nor into 't3'.
371352
execute stmt using @var;
372-
ERROR 42S02: Table 'test.t3' doesn't exist
373353
call p_verify_reprepare_count(1);
374354
SUCCESS
375355

376356
select * from t2;
377357
a
378358
5
379-
select * from t3;
380-
a
381-
6
382-
7
383-
flush table t1;
384-
set @var=9;
385-
execute stmt using @var;
386-
call p_verify_reprepare_count(1);
387-
SUCCESS
388-
389-
select * from t2;
390-
a
391-
5
392-
9
359+
8
393360
select * from t3;
394361
a
395362
6

0 commit comments

Comments
 (0)