Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1cda2aa1
Commit
1cda2aa1
authored
Jun 14, 2023
by
Dmitry Shulga
Committed by
Sergei Golubchik
Jun 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-5816: Stored programs: validation of stored program statements
Fix of existing mtr tests.
parent
0b0188c5
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
32 deletions
+39
-32
mysql-test/main/join.result
mysql-test/main/join.result
+2
-2
mysql-test/main/ps_ddl.result
mysql-test/main/ps_ddl.result
+13
-7
mysql-test/main/ps_ddl.test
mysql-test/main/ps_ddl.test
+9
-7
mysql-test/main/sp.result
mysql-test/main/sp.result
+5
-5
mysql-test/main/sp.test
mysql-test/main/sp.test
+3
-4
mysql-test/main/subselect3.inc
mysql-test/main/subselect3.inc
+0
-1
mysql-test/main/subselect3.result
mysql-test/main/subselect3.result
+1
-1
mysql-test/main/subselect3_jcl6.result
mysql-test/main/subselect3_jcl6.result
+1
-1
mysql-test/suite/sys_vars/r/stored_program_cache_func.result
mysql-test/suite/sys_vars/r/stored_program_cache_func.result
+1
-2
mysql-test/suite/sys_vars/t/stored_program_cache_func.test
mysql-test/suite/sys_vars/t/stored_program_cache_func.test
+4
-2
No files found.
mysql-test/main/join.result
View file @
1cda2aa1
...
...
@@ -1544,9 +1544,9 @@ f
DROP TABLE t;
CREATE TABLE t (i INT);
CALL p;
ERROR 42S22: Unknown column '
t1.f' in 'field list
'
ERROR 42S22: Unknown column '
f' in 'from clause
'
CALL p;
ERROR 42S22: Unknown column '
t1.f' in 'field list
'
ERROR 42S22: Unknown column '
f' in 'from clause
'
DROP PROCEDURE p;
DROP TABLE t;
CREATE TABLE t1 (a INT, b INT);
...
...
mysql-test/main/ps_ddl.result
View file @
1cda2aa1
...
...
@@ -320,8 +320,8 @@ create table t3 (a int unique);
create view v1 as select a from t2;
create trigger t1_ai after insert on t1 for each row
insert into v1 (a) values (new.a);
# Demonstrate that th
e same bug is present
#
without
prepared statements
# Demonstrate that th
is bug is fixed by MDEV-5816
#
both for regular and
prepared statements
insert into t1 (a) values (5);
select * from t2;
a
...
...
@@ -331,15 +331,15 @@ a
drop view v1;
create view v1 as select a from t3;
insert into t1 (a) values (6);
ERROR 42S02: Table 'test.t2' doesn't exist
flush table t1;
insert into t1 (a) values (6);
insert into t1 (a) values (6
0
);
select * from t2;
a
5
select * from t3;
a
6
60
prepare stmt from "insert into t1 (a) values (?)";
set @var=7;
execute stmt using @var;
...
...
@@ -350,6 +350,7 @@ select * from t3;
a
6
7
60
select * from t2;
a
5
...
...
@@ -364,23 +365,26 @@ set @var=8;
# but repreparation of the main statement doesn't cause repreparation
# of trigger statements.
#
# The following EXECUTE results in ER_NO_SUCH_TABLE (t3) error, because
# pre-locking list of the prepared statement has been changed
# Prior MDEV-5816, the following EXECUTE resulted in
# ER_NO_SUCH_TABLE (t3) error, because pre-locking list of the prepared
# statement has been changed
# (the prepared statement has noticed the meta-data change),
# but the trigger still tries to deal with 't3', which is not opened.
# That's why '8' is not inserted neither into 't2', nor into 't3'.
# After the task MDEV-5816 be implemented this issue does't exist.
execute stmt using @var;
ERROR 42S02: Table 'test.t3' doesn't exist
call p_verify_reprepare_count(1);
SUCCESS
select * from t2;
a
5
8
select * from t3;
a
6
7
60
flush table t1;
set @var=9;
execute stmt using @var;
...
...
@@ -390,11 +394,13 @@ SUCCESS
select * from t2;
a
5
8
9
select * from t3;
a
6
7
60
drop view v1;
drop table t1,t2,t3;
# Test 7-d: dependent TABLE has changed
...
...
mysql-test/main/ps_ddl.test
View file @
1cda2aa1
...
...
@@ -334,17 +334,18 @@ create view v1 as select a from t2;
create
trigger
t1_ai
after
insert
on
t1
for
each
row
insert
into
v1
(
a
)
values
(
new
.
a
);
--
echo
# Demonstrate that th
e same bug is present
--
echo
#
without
prepared statements
--
echo
# Demonstrate that th
is bug is fixed by MDEV-5816
--
echo
#
both for regular and
prepared statements
insert
into
t1
(
a
)
values
(
5
);
select
*
from
t2
;
select
*
from
t3
;
drop
view
v1
;
create
view
v1
as
select
a
from
t3
;
--
error
ER_NO_SUCH_TABLE
# Before MDEV-5816 the following statement would fail
# with the error ER_NO_SUCH_TABLE
insert
into
t1
(
a
)
values
(
6
);
flush
table
t1
;
insert
into
t1
(
a
)
values
(
6
);
insert
into
t1
(
a
)
values
(
6
0
);
select
*
from
t2
;
select
*
from
t3
;
...
...
@@ -365,12 +366,13 @@ set @var=8;
--
echo
# but repreparation of the main statement doesn't cause repreparation
--
echo
# of trigger statements.
--
echo
#
--
echo
# The following EXECUTE results in ER_NO_SUCH_TABLE (t3) error, because
--
echo
# pre-locking list of the prepared statement has been changed
--
echo
# Prior MDEV-5816, the following EXECUTE resulted in
--
echo
# ER_NO_SUCH_TABLE (t3) error, because pre-locking list of the prepared
--
echo
# statement has been changed
--
echo
# (the prepared statement has noticed the meta-data change),
--
echo
# but the trigger still tries to deal with 't3', which is not opened.
--
echo
# That's why '8' is not inserted neither into 't2', nor into 't3'.
--
e
rror
ER_NO_SUCH_TABLE
--
e
cho
# After the task MDEV-5816 be implemented this issue does't exist.
execute
stmt
using
@
var
;
call
p_verify_reprepare_count
(
1
);
select
*
from
t2
;
...
...
mysql-test/main/sp.result
View file @
1cda2aa1
...
...
@@ -6775,7 +6775,7 @@ call p1$
a
alter table t1 add b integer$
call p1$
a
a
b
drop table t1;
drop procedure p1;
# ------------------------------------------------------------------
...
...
@@ -7240,12 +7240,12 @@ create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5);
#
# Do we correctly resolve identifiers in LIMIT?
#
Since DROP and CREATE did not invalidate
#
the SP cache, we can't test until
#
we drop and re-create the procedure.
#
DROP and CREATE results in SP statement recompilation
#
so second execution of the procedure p1() doesn't lead
#
to issuing an error
#
call p1();
ERROR 42S22: Unknown column 'test.t1.c1' in 'field list'
a
#
# Drop and recreate the procedure, then repeat
#
...
...
mysql-test/main/sp.test
View file @
1cda2aa1
...
...
@@ -8700,11 +8700,10 @@ create table t1 (a int);
insert
into
t1
(
a
)
values
(
1
),
(
2
),
(
3
),
(
4
),
(
5
);
--
echo
#
--
echo
# Do we correctly resolve identifiers in LIMIT?
--
echo
#
Since DROP and CREATE did not invalidate
--
echo
#
the SP cache, we can't test until
--
echo
#
we drop and re-create the procedure.
--
echo
#
DROP and CREATE results in SP statement recompilation
--
echo
#
so second execution of the procedure p1() doesn't lead
--
echo
#
to issuing an error
--
echo
#
--
error
ER_BAD_FIELD_ERROR
call
p1
();
--
echo
#
--
echo
# Drop and recreate the procedure, then repeat
...
...
mysql-test/main/subselect3.inc
View file @
1cda2aa1
...
...
@@ -1221,7 +1221,6 @@ CREATE PROCEDURE p1 () BEGIN SELECT f1 FROM t1 WHERE f1 IN (SELECT f1 FROM t2);
delimiter
;
|
CALL
p1
;
ALTER
TABLE
t2
CHANGE
COLUMN
f1
my_column
INT
;
--
error
ER_BAD_FIELD_ERROR
CALL
p1
;
DROP
PROCEDURE
p1
;
DROP
TABLE
t1
,
t2
;
...
...
mysql-test/main/subselect3.result
View file @
1cda2aa1
...
...
@@ -1472,7 +1472,7 @@ CALL p1;
f1
ALTER TABLE t2 CHANGE COLUMN f1 my_column INT;
CALL p1;
ERROR 42S22: Unknown column 'f1' in 'where clause'
f1
DROP PROCEDURE p1;
DROP TABLE t1, t2;
#
...
...
mysql-test/main/subselect3_jcl6.result
View file @
1cda2aa1
...
...
@@ -1475,7 +1475,7 @@ CALL p1;
f1
ALTER TABLE t2 CHANGE COLUMN f1 my_column INT;
CALL p1;
ERROR 42S22: Unknown column 'f1' in 'where clause'
f1
DROP PROCEDURE p1;
DROP TABLE t1, t2;
#
...
...
mysql-test/suite/sys_vars/r/stored_program_cache_func.result
View file @
1cda2aa1
...
...
@@ -41,8 +41,7 @@ end |
call pr(1);
b
call pr(2);
ERROR 42S22: Unknown column 'test.t1.b' in 'field list'
drop table t1;
a
set global stored_program_cache=0;
call pr(1);
b
...
...
mysql-test/suite/sys_vars/t/stored_program_cache_func.test
View file @
1cda2aa1
...
...
@@ -33,9 +33,11 @@ create procedure pr(i int) begin
end
|
--
delimiter
;
call
pr
(
1
);
--
error
ER_BAD_FIELD_ERROR
#--error ER_BAD_FIELD_ERROR
# MDEV-5816 added support for recompilation of statements
# inside a stored routine so the error ER_BAD_FIELD_ERROR is
# no more expcted
call
pr
(
2
);
drop
table
t1
;
set
global
stored_program_cache
=
0
;
call
pr
(
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment