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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
6f63650d
Commit
6f63650d
authored
Dec 02, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test case for Bug#5967 "Stored procedure declared variable
used instead of column", the bug is to be fixed later.
parent
b7d7f78f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
0 deletions
+99
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+54
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+45
-0
No files found.
mysql-test/r/sp.result
View file @
6f63650d
...
@@ -4099,4 +4099,58 @@ call bug14376(4711)|
...
@@ -4099,4 +4099,58 @@ call bug14376(4711)|
x
x
4711
4711
drop procedure bug14376|
drop procedure bug14376|
drop procedure if exists p1|
Warnings:
Note 1305 PROCEDURE p1 does not exist
drop table if exists t1|
create table t1 (a varchar(255))|
insert into t1 (a) values ("a - table column")|
create procedure p1(a varchar(255))
begin
declare i varchar(255);
declare c cursor for select a from t1;
select a;
select a from t1 into i;
select i as 'Parameter takes precedence over table column'; open c;
fetch c into i;
close c;
select i as 'Parameter takes precedence over table column in cursors';
begin
declare a varchar(255) default 'a - local variable';
declare c1 cursor for select a from t1;
select a as 'A local variable takes precedence over parameter';
open c1;
fetch c1 into i;
close c1;
select i as 'A local variable takes precedence over parameter in cursors';
begin
declare a varchar(255) default 'a - local variable in a nested compound statement';
declare c2 cursor for select a from t1;
select a as 'A local variable in a nested compound statement takes precedence over a local variable in the outer statement';
select a from t1 into i;
select i as 'A local variable in a nested compound statement takes precedence over table column';
open c2;
fetch c2 into i;
close c2;
select i as 'A local variable in a nested compound statement takes precedence over table column in cursors';
end;
end;
end|
call p1("a - stored procedure parameter")|
a
a - stored procedure parameter
Parameter takes precedence over table column
a - stored procedure parameter
Parameter takes precedence over table column in cursors
a - stored procedure parameter
A local variable takes precedence over parameter
a - local variable
A local variable takes precedence over parameter in cursors
a - local variable
A local variable in a nested compound statement takes precedence over a local variable in the outer statement
a - local variable in a nested compound statement
A local variable in a nested compound statement takes precedence over table column
a - local variable in a nested compound statement
A local variable in a nested compound statement takes precedence over table column in cursors
a - local variable in a nested compound statement
drop table t1,t2;
drop table t1,t2;
mysql-test/t/sp.test
View file @
6f63650d
...
@@ -4898,7 +4898,52 @@ call bug14376(4711)|
...
@@ -4898,7 +4898,52 @@ call bug14376(4711)|
drop
procedure
bug14376
|
drop
procedure
bug14376
|
#
# Bug#5967 "Stored procedure declared variable used instead of column"
# The bug should be fixed later.
# Test precedence of names of parameters, variable declarations,
# variable declarations in nested compound statements, table columns,
# table columns in cursor declarations.
# According to the standard, table columns take precedence over
# variable declarations. In MySQL 5.0 it's vice versa.
#
drop
procedure
if
exists
p1
|
drop
table
if
exists
t1
|
create
table
t1
(
a
varchar
(
255
))
|
insert
into
t1
(
a
)
values
(
"a - table column"
)
|
create
procedure
p1
(
a
varchar
(
255
))
begin
declare
i
varchar
(
255
);
declare
c
cursor
for
select
a
from
t1
;
select
a
;
select
a
from
t1
into
i
;
select
i
as
'Parameter takes precedence over table column'
;
open
c
;
fetch
c
into
i
;
close
c
;
select
i
as
'Parameter takes precedence over table column in cursors'
;
begin
declare
a
varchar
(
255
)
default
'a - local variable'
;
declare
c1
cursor
for
select
a
from
t1
;
select
a
as
'A local variable takes precedence over parameter'
;
open
c1
;
fetch
c1
into
i
;
close
c1
;
select
i
as
'A local variable takes precedence over parameter in cursors'
;
begin
declare
a
varchar
(
255
)
default
'a - local variable in a nested compound statement'
;
declare
c2
cursor
for
select
a
from
t1
;
select
a
as
'A local variable in a nested compound statement takes precedence over a local variable in the outer statement'
;
select
a
from
t1
into
i
;
select
i
as
'A local variable in a nested compound statement takes precedence over table column'
;
open
c2
;
fetch
c2
into
i
;
close
c2
;
select
i
as
'A local variable in a nested compound statement takes precedence over table column in cursors'
;
end
;
end
;
end
|
call
p1
(
"a - stored procedure parameter"
)
|
#
#
# BUG#NNNN: New bug synopsis
# BUG#NNNN: New bug synopsis
...
...
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