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
47044ea6
Commit
47044ea6
authored
Nov 17, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/dlenev/src/mysql-5.0-bg13399-2
parents
b6707610
d518f702
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
10 deletions
+115
-10
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+18
-0
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+25
-0
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+22
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+39
-0
sql/sp_head.cc
sql/sp_head.cc
+11
-10
No files found.
mysql-test/r/sp-error.result
View file @
47044ea6
...
@@ -975,6 +975,24 @@ return 1;
...
@@ -975,6 +975,24 @@ return 1;
END |
END |
drop table t1|
drop table t1|
drop function bug_13627_f|
drop function bug_13627_f|
drop function if exists bug12329;
create table t1 as select 1 a;
create table t2 as select 1 a;
create function bug12329() returns int return (select a from t1);
prepare stmt1 from 'select bug12329()';
execute stmt1;
bug12329()
1
drop function bug12329;
create function bug12329() returns int return (select a+100 from t2);
select bug12329();
bug12329()
101
execute stmt1;
ERROR HY000: Table 't2' was not locked with LOCK TABLES
deallocate prepare stmt1;
drop function bug12329;
drop table t1, t2;
create database mysqltest1;
create database mysqltest1;
use mysqltest1;
use mysqltest1;
drop database mysqltest1;
drop database mysqltest1;
...
...
mysql-test/r/trigger.result
View file @
47044ea6
...
@@ -738,3 +738,28 @@ f1
...
@@ -738,3 +738,28 @@ f1
1
1
drop trigger t1_bi;
drop trigger t1_bi;
drop tables t1, t2;
drop tables t1, t2;
create table t1 (id int);
create table t2 (id int);
create trigger t1_bi before insert on t1 for each row insert into t2 values (new.id);
prepare stmt1 from "insert into t1 values (10)";
create procedure p1() insert into t1 values (10);
call p1();
drop trigger t1_bi;
execute stmt1;
call p1();
deallocate prepare stmt1;
drop procedure p1;
create table t3 (id int);
create trigger t1_bi after insert on t1 for each row insert into t2 values (new.id);
prepare stmt1 from "insert into t1 values (10)";
create procedure p1() insert into t1 values (10);
call p1();
drop trigger t1_bi;
create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id);
execute stmt1;
ERROR HY000: Table 't3' was not locked with LOCK TABLES
call p1();
ERROR HY000: Table 't3' was not locked with LOCK TABLES
deallocate prepare stmt1;
drop procedure p1;
drop table t1, t2, t3;
mysql-test/t/sp-error.test
View file @
47044ea6
...
@@ -1403,6 +1403,28 @@ drop function bug_13627_f|
...
@@ -1403,6 +1403,28 @@ drop function bug_13627_f|
delimiter
;
|
delimiter
;
|
# BUG#12329: "Bogus error msg when executing PS with stored procedure after
# SP was re-created". See also test for related bug#13399 in trigger.test
--
disable_warnings
drop
function
if
exists
bug12329
;
--
enable_warnings
create
table
t1
as
select
1
a
;
create
table
t2
as
select
1
a
;
create
function
bug12329
()
returns
int
return
(
select
a
from
t1
);
prepare
stmt1
from
'select bug12329()'
;
execute
stmt1
;
drop
function
bug12329
;
create
function
bug12329
()
returns
int
return
(
select
a
+
100
from
t2
);
select
bug12329
();
# Until we implement proper mechanism for invalidation of PS/SP when table
# or SP's are changed the following statement will fail with 'Table ... was
# not locked' error (this mechanism should be based on the new TDC).
--
error
1100
execute
stmt1
;
deallocate
prepare
stmt1
;
drop
function
bug12329
;
drop
table
t1
,
t2
;
#
#
# Bug#13514 "server crash when create a stored procedure before choose a
# Bug#13514 "server crash when create a stored procedure before choose a
# database" and
# database" and
...
...
mysql-test/t/trigger.test
View file @
47044ea6
...
@@ -875,3 +875,42 @@ drop function f1;
...
@@ -875,3 +875,42 @@ drop function f1;
drop
view
v1
;
drop
view
v1
;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
--
enable_parsing
--
enable_parsing
#
# Test for bug #13399 "Crash when executing PS/SP which should activate
# trigger which is now dropped". See also test for similar bug for stored
# routines in sp-error.test (#12329).
create
table
t1
(
id
int
);
create
table
t2
(
id
int
);
create
trigger
t1_bi
before
insert
on
t1
for
each
row
insert
into
t2
values
(
new
.
id
);
prepare
stmt1
from
"insert into t1 values (10)"
;
create
procedure
p1
()
insert
into
t1
values
(
10
);
call
p1
();
# Actually it is enough to do FLUSH TABLES instead of DROP TRIGGER
drop
trigger
t1_bi
;
# Server should not crash on these two statements
execute
stmt1
;
call
p1
();
deallocate
prepare
stmt1
;
drop
procedure
p1
;
# Let us test more complex situation when we alter trigger in such way that
# it uses different set of tables (or simply add new trigger).
create
table
t3
(
id
int
);
create
trigger
t1_bi
after
insert
on
t1
for
each
row
insert
into
t2
values
(
new
.
id
);
prepare
stmt1
from
"insert into t1 values (10)"
;
create
procedure
p1
()
insert
into
t1
values
(
10
);
call
p1
();
# Altering trigger forcing it use different set of tables
drop
trigger
t1_bi
;
create
trigger
t1_bi
after
insert
on
t1
for
each
row
insert
into
t3
values
(
new
.
id
);
# Until we implement proper mechanism for invalidation of PS/SP when table
# or SP's are changed these two statements will fail with 'Table ... was
# not locked' error (this mechanism should be based on the new TDC).
--
error
1100
execute
stmt1
;
--
error
1100
call
p1
();
deallocate
prepare
stmt1
;
drop
procedure
p1
;
drop
table
t1
,
t2
,
t3
;
sql/sp_head.cc
View file @
47044ea6
...
@@ -2906,33 +2906,34 @@ sp_head::add_used_tables_to_table_list(THD *thd,
...
@@ -2906,33 +2906,34 @@ sp_head::add_used_tables_to_table_list(THD *thd,
DBUG_ENTER
(
"sp_head::add_used_tables_to_table_list"
);
DBUG_ENTER
(
"sp_head::add_used_tables_to_table_list"
);
/*
/*
Use persistent arena for table list allocation to be PS friendly.
Use persistent arena for table list allocation to be PS/SP friendly.
Note that we also have to copy database/table names and alias to PS/SP
memory since current instance of sp_head object can pass away before
next execution of PS/SP for which tables are added to prelocking list.
This will be fixed by introducing of proper invalidation mechanism
once new TDC is ready.
*/
*/
arena
=
thd
->
activate_stmt_arena_if_needed
(
&
backup
);
arena
=
thd
->
activate_stmt_arena_if_needed
(
&
backup
);
for
(
i
=
0
;
i
<
m_sptabs
.
records
;
i
++
)
for
(
i
=
0
;
i
<
m_sptabs
.
records
;
i
++
)
{
{
char
*
tab_buff
;
char
*
tab_buff
,
*
key_buff
;
TABLE_LIST
*
table
;
TABLE_LIST
*
table
;
SP_TABLE
*
stab
=
(
SP_TABLE
*
)
hash_element
(
&
m_sptabs
,
i
);
SP_TABLE
*
stab
=
(
SP_TABLE
*
)
hash_element
(
&
m_sptabs
,
i
);
if
(
stab
->
temp
)
if
(
stab
->
temp
)
continue
;
continue
;
if
(
!
(
tab_buff
=
(
char
*
)
thd
->
calloc
(
ALIGN_SIZE
(
sizeof
(
TABLE_LIST
))
*
if
(
!
(
tab_buff
=
(
char
*
)
thd
->
calloc
(
ALIGN_SIZE
(
sizeof
(
TABLE_LIST
))
*
stab
->
lock_count
)))
stab
->
lock_count
))
||
!
(
key_buff
=
(
char
*
)
thd
->
memdup
(
stab
->
qname
.
str
,
stab
->
qname
.
length
+
1
)))
DBUG_RETURN
(
FALSE
);
DBUG_RETURN
(
FALSE
);
for
(
uint
j
=
0
;
j
<
stab
->
lock_count
;
j
++
)
for
(
uint
j
=
0
;
j
<
stab
->
lock_count
;
j
++
)
{
{
table
=
(
TABLE_LIST
*
)
tab_buff
;
table
=
(
TABLE_LIST
*
)
tab_buff
;
/*
table
->
db
=
key_buff
;
It's enough to just copy the pointers as the data will not change
during the lifetime of the SP. If the SP is used by PS, we assume
that the PS will be invalidated if the functions is deleted or
changed.
*/
table
->
db
=
stab
->
qname
.
str
;
table
->
db_length
=
stab
->
db_length
;
table
->
db_length
=
stab
->
db_length
;
table
->
table_name
=
table
->
db
+
table
->
db_length
+
1
;
table
->
table_name
=
table
->
db
+
table
->
db_length
+
1
;
table
->
table_name_length
=
stab
->
table_name_length
;
table
->
table_name_length
=
stab
->
table_name_length
;
...
...
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