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
d969cbc5
Commit
d969cbc5
authored
Dec 02, 2009
by
Evgeny Potemkin
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merged fix for the bug#48508.
parents
ee136e3f
7853f553
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
2 deletions
+49
-2
mysql-test/r/ps.result
mysql-test/r/ps.result
+23
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+21
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+1
-1
sql/sql_base.cc
sql/sql_base.cc
+2
-1
sql/sql_class.h
sql/sql_class.h
+2
-0
No files found.
mysql-test/r/ps.result
View file @
d969cbc5
...
@@ -1891,4 +1891,27 @@ execute stmt using @arg;
...
@@ -1891,4 +1891,27 @@ execute stmt using @arg;
?
?
-12345.5432100000
-12345.5432100000
deallocate prepare stmt;
deallocate prepare stmt;
#
# Bug#48508: Crash on prepared statement re-execution.
#
create table t1(b int);
insert into t1 values (0);
create view v1 AS select 1 as a from t1 where b;
prepare stmt from "select * from v1 where a";
execute stmt;
a
execute stmt;
a
drop table t1;
drop view v1;
create table t1(a bigint);
create table t2(b tinyint);
insert into t2 values (null);
prepare stmt from "select 1 from t1 join t2 on a xor b where b > 1 and a =1";
execute stmt;
1
execute stmt;
1
drop table t1,t2;
#
End of 5.0 tests.
End of 5.0 tests.
mysql-test/t/ps.test
View file @
d969cbc5
...
@@ -1973,4 +1973,25 @@ select @arg;
...
@@ -1973,4 +1973,25 @@ select @arg;
execute
stmt
using
@
arg
;
execute
stmt
using
@
arg
;
deallocate
prepare
stmt
;
deallocate
prepare
stmt
;
--
echo
#
--
echo
# Bug#48508: Crash on prepared statement re-execution.
--
echo
#
create
table
t1
(
b
int
);
insert
into
t1
values
(
0
);
create
view
v1
AS
select
1
as
a
from
t1
where
b
;
prepare
stmt
from
"select * from v1 where a"
;
execute
stmt
;
execute
stmt
;
drop
table
t1
;
drop
view
v1
;
create
table
t1
(
a
bigint
);
create
table
t2
(
b
tinyint
);
insert
into
t2
values
(
null
);
prepare
stmt
from
"select 1 from t1 join t2 on a xor b where b > 1 and a =1"
;
execute
stmt
;
execute
stmt
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
sql/item_cmpfunc.cc
View file @
d969cbc5
...
@@ -3907,7 +3907,7 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p,
...
@@ -3907,7 +3907,7 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p,
byte
*
arg_v
=
*
arg_p
;
byte
*
arg_v
=
*
arg_p
;
Item
*
new_item
=
item
->
compile
(
analyzer
,
&
arg_v
,
transformer
,
arg_t
);
Item
*
new_item
=
item
->
compile
(
analyzer
,
&
arg_v
,
transformer
,
arg_t
);
if
(
new_item
&&
new_item
!=
item
)
if
(
new_item
&&
new_item
!=
item
)
li
.
replace
(
new_item
);
current_thd
->
change_item_tree
(
li
.
ref
(),
new_item
);
}
}
return
Item_func
::
transform
(
transformer
,
arg_t
);
return
Item_func
::
transform
(
transformer
,
arg_t
);
}
}
...
...
sql/sql_base.cc
View file @
d969cbc5
...
@@ -3481,7 +3481,8 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
...
@@ -3481,7 +3481,8 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
if
(
!
my_strcasecmp
(
system_charset_info
,
field_it
.
name
(),
name
))
if
(
!
my_strcasecmp
(
system_charset_info
,
field_it
.
name
(),
name
))
{
{
// in PS use own arena or data will be freed after prepare
// in PS use own arena or data will be freed after prepare
if
(
register_tree_change
&&
thd
->
stmt_arena
->
is_stmt_prepare_or_first_sp_execute
())
if
(
register_tree_change
&&
thd
->
stmt_arena
->
is_stmt_prepare_or_first_stmt_execute
())
arena
=
thd
->
activate_stmt_arena_if_needed
(
&
backup
);
arena
=
thd
->
activate_stmt_arena_if_needed
(
&
backup
);
/*
/*
create_item() may, or may not create a new Item, depending on
create_item() may, or may not create a new Item, depending on
...
...
sql/sql_class.h
View file @
d969cbc5
...
@@ -759,6 +759,8 @@ public:
...
@@ -759,6 +759,8 @@ public:
{
return
state
==
INITIALIZED_FOR_SP
;
}
{
return
state
==
INITIALIZED_FOR_SP
;
}
inline
bool
is_stmt_prepare_or_first_sp_execute
()
const
inline
bool
is_stmt_prepare_or_first_sp_execute
()
const
{
return
(
int
)
state
<
(
int
)
PREPARED
;
}
{
return
(
int
)
state
<
(
int
)
PREPARED
;
}
inline
bool
is_stmt_prepare_or_first_stmt_execute
()
const
{
return
(
int
)
state
<=
(
int
)
PREPARED
;
}
inline
bool
is_first_stmt_execute
()
const
{
return
state
==
PREPARED
;
}
inline
bool
is_first_stmt_execute
()
const
{
return
state
==
PREPARED
;
}
inline
bool
is_stmt_execute
()
const
inline
bool
is_stmt_execute
()
const
{
return
state
==
PREPARED
||
state
==
EXECUTED
;
}
{
return
state
==
PREPARED
||
state
==
EXECUTED
;
}
...
...
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