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
035c24be
Commit
035c24be
authored
Dec 02, 2005
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/usr/home/pem/bug14376/mysql-5.0
parents
681252c8
ed6e09a3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
3 deletions
+100
-3
mysql-test/r/sp.result
mysql-test/r/sp.result
+29
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+45
-0
sql/sp_pcontext.cc
sql/sp_pcontext.cc
+2
-2
sql/sp_pcontext.h
sql/sp_pcontext.h
+17
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+7
-1
No files found.
mysql-test/r/sp.result
View file @
035c24be
...
@@ -4070,4 +4070,33 @@ a
...
@@ -4070,4 +4070,33 @@ a
3
3
drop procedure bug14304|
drop procedure bug14304|
drop table t3, t4|
drop table t3, t4|
drop procedure if exists bug14376|
create procedure bug14376()
begin
declare x int default x;
end|
call bug14376()|
ERROR 42S22: Unknown column 'x' in 'field list'
drop procedure bug14376|
create procedure bug14376()
begin
declare x int default 42;
begin
declare x int default x;
select x;
end;
end|
call bug14376()|
x
42
drop procedure bug14376|
create procedure bug14376(x int)
begin
declare x int default x;
select x;
end|
call bug14376(4711)|
x
4711
drop procedure bug14376|
drop table t1,t2;
drop table t1,t2;
mysql-test/t/sp.test
View file @
035c24be
...
@@ -4855,6 +4855,51 @@ call bug14304()|
...
@@ -4855,6 +4855,51 @@ call bug14304()|
drop
procedure
bug14304
|
drop
procedure
bug14304
|
drop
table
t3
,
t4
|
drop
table
t3
,
t4
|
#
# BUG#14376: MySQL crash on scoped variable (re)initialization
#
--
disable_warnings
drop
procedure
if
exists
bug14376
|
--
enable_warnings
create
procedure
bug14376
()
begin
declare
x
int
default
x
;
end
|
# Not the error we want, but that's what we got for now...
--
error
ER_BAD_FIELD_ERROR
call
bug14376
()
|
drop
procedure
bug14376
|
create
procedure
bug14376
()
begin
declare
x
int
default
42
;
begin
declare
x
int
default
x
;
select
x
;
end
;
end
|
call
bug14376
()
|
drop
procedure
bug14376
|
create
procedure
bug14376
(
x
int
)
begin
declare
x
int
default
x
;
select
x
;
end
|
call
bug14376
(
4711
)
|
drop
procedure
bug14376
|
#
#
# BUG#NNNN: New bug synopsis
# BUG#NNNN: New bug synopsis
#
#
...
...
sql/sp_pcontext.cc
View file @
035c24be
...
@@ -52,7 +52,7 @@ sp_cond_check(LEX_STRING *sqlstate)
...
@@ -52,7 +52,7 @@ sp_cond_check(LEX_STRING *sqlstate)
sp_pcontext
::
sp_pcontext
(
sp_pcontext
*
prev
)
sp_pcontext
::
sp_pcontext
(
sp_pcontext
*
prev
)
:
Sql_alloc
(),
m_psubsize
(
0
),
m_csubsize
(
0
),
m_hsubsize
(
0
),
:
Sql_alloc
(),
m_psubsize
(
0
),
m_csubsize
(
0
),
m_hsubsize
(
0
),
m_handlers
(
0
),
m_parent
(
prev
)
m_handlers
(
0
),
m_parent
(
prev
)
,
m_pboundary
(
0
)
{
{
VOID
(
my_init_dynamic_array
(
&
m_pvar
,
sizeof
(
sp_pvar_t
*
),
16
,
8
));
VOID
(
my_init_dynamic_array
(
&
m_pvar
,
sizeof
(
sp_pvar_t
*
),
16
,
8
));
VOID
(
my_init_dynamic_array
(
&
m_cond
,
sizeof
(
sp_cond_type_t
*
),
16
,
8
));
VOID
(
my_init_dynamic_array
(
&
m_cond
,
sizeof
(
sp_cond_type_t
*
),
16
,
8
));
...
@@ -150,7 +150,7 @@ sp_pcontext::diff_cursors(sp_pcontext *ctx)
...
@@ -150,7 +150,7 @@ sp_pcontext::diff_cursors(sp_pcontext *ctx)
sp_pvar_t
*
sp_pvar_t
*
sp_pcontext
::
find_pvar
(
LEX_STRING
*
name
,
my_bool
scoped
)
sp_pcontext
::
find_pvar
(
LEX_STRING
*
name
,
my_bool
scoped
)
{
{
uint
i
=
m_pvar
.
elements
;
uint
i
=
m_pvar
.
elements
-
m_pboundary
;
while
(
i
--
)
while
(
i
--
)
{
{
...
...
sql/sp_pcontext.h
View file @
035c24be
...
@@ -174,6 +174,16 @@ class sp_pcontext : public Sql_alloc
...
@@ -174,6 +174,16 @@ class sp_pcontext : public Sql_alloc
sp_pvar_t
*
sp_pvar_t
*
find_pvar
(
uint
offset
);
find_pvar
(
uint
offset
);
/*
Set the current scope boundary (for default values)
The argument is the number of variables to skip.
*/
inline
void
declare_var_boundary
(
uint
n
)
{
m_pboundary
=
n
;
}
//
//
// Labels
// Labels
//
//
...
@@ -282,6 +292,13 @@ private:
...
@@ -282,6 +292,13 @@ private:
uint
m_poffset
;
// Variable offset for this context
uint
m_poffset
;
// Variable offset for this context
uint
m_coffset
;
// Cursor offset for this context
uint
m_coffset
;
// Cursor offset for this context
/*
Boundary for finding variables in this context. This is the number
of variables currently "invisible" to default clauses.
This is normally 0, but will be larger during parsing of
DECLARE ... DEFAULT, to get the scope right for DEFAULT values.
*/
uint
m_pboundary
;
DYNAMIC_ARRAY
m_pvar
;
// Parameters/variables
DYNAMIC_ARRAY
m_pvar
;
// Parameters/variables
DYNAMIC_ARRAY
m_cond
;
// Conditions
DYNAMIC_ARRAY
m_cond
;
// Conditions
...
...
sql/sql_yacc.yy
View file @
035c24be
...
@@ -1592,7 +1592,12 @@ sp_decls:
...
@@ -1592,7 +1592,12 @@ sp_decls:
sp_decl:
sp_decl:
DECLARE_SYM sp_decl_idents type
DECLARE_SYM sp_decl_idents type
{ Lex->sphead->reset_lex(YYTHD); }
{
LEX *lex= Lex;
lex->sphead->reset_lex(YYTHD);
lex->spcont->declare_var_boundary($2);
}
sp_opt_default
sp_opt_default
{
{
LEX *lex= Lex;
LEX *lex= Lex;
...
@@ -1623,6 +1628,7 @@ sp_decl:
...
@@ -1623,6 +1628,7 @@ sp_decl:
lex->sphead->add_instr(in);
lex->sphead->add_instr(in);
ctx->set_default(off, it);
ctx->set_default(off, it);
}
}
ctx->declare_var_boundary(0);
lex->sphead->restore_lex(YYTHD);
lex->sphead->restore_lex(YYTHD);
$$.vars= $2;
$$.vars= $2;
$$.conds= $$.hndlrs= $$.curs= 0;
$$.conds= $$.hndlrs= $$.curs= 0;
...
...
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