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
568dda14
Commit
568dda14
authored
Feb 01, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rakia.gmz:/home/kgeorge/mysql/autopush/B23556-5.0-opt
parents
f6eddc01
c63f242a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
1 deletion
+55
-1
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+25
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+25
-0
sql/sql_delete.cc
sql/sql_delete.cc
+5
-1
No files found.
mysql-test/r/trigger.result
View file @
568dda14
...
@@ -1241,6 +1241,31 @@ i j
...
@@ -1241,6 +1241,31 @@ i j
2 2
2 2
13 13
13 13
drop table t1;
drop table t1;
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
CREATE TRIGGER trg_t1 BEFORE DELETE on t1 FOR EACH ROW
INSERT INTO t2 VALUES (OLD.a);
FLUSH STATUS;
TRUNCATE t1;
SHOW STATUS LIKE 'handler_delete';
Variable_name Value
Handler_delete 0
SELECT COUNT(*) FROM t2;
COUNT(*)
0
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
DELETE FROM t2;
FLUSH STATUS;
DELETE FROM t1;
SHOW STATUS LIKE 'handler_delete';
Variable_name Value
Handler_delete 8
SELECT COUNT(*) FROM t2;
COUNT(*)
8
DROP TRIGGER trg_t1;
DROP TABLE t1,t2;
drop table if exists t1;
drop table if exists t1;
drop function if exists f1;
drop function if exists f1;
create table t1 (i int);
create table t1 (i int);
...
...
mysql-test/t/trigger.test
View file @
568dda14
...
@@ -1505,6 +1505,31 @@ update t1 set i= i+ 10 where j > 2;
...
@@ -1505,6 +1505,31 @@ update t1 set i= i+ 10 where j > 2;
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug#23556 TRUNCATE TABLE still maps to DELETE
#
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
);
CREATE
TABLE
t2
(
a
INT
PRIMARY
KEY
);
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
);
CREATE
TRIGGER
trg_t1
BEFORE
DELETE
on
t1
FOR
EACH
ROW
INSERT
INTO
t2
VALUES
(
OLD
.
a
);
FLUSH
STATUS
;
TRUNCATE
t1
;
SHOW
STATUS
LIKE
'handler_delete'
;
SELECT
COUNT
(
*
)
FROM
t2
;
INSERT
INTO
t1
VALUES
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
);
DELETE
FROM
t2
;
FLUSH
STATUS
;
DELETE
FROM
t1
;
SHOW
STATUS
LIKE
'handler_delete'
;
SELECT
COUNT
(
*
)
FROM
t2
;
DROP
TRIGGER
trg_t1
;
DROP
TABLE
t1
,
t2
;
#
#
# Bug #23651 "Server crashes when trigger which uses stored function
# Bug #23651 "Server crashes when trigger which uses stored function
...
...
sql/sql_delete.cc
View file @
568dda14
...
@@ -75,10 +75,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -75,10 +75,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
Test if the user wants to delete all rows and deletion doesn't have
Test if the user wants to delete all rows and deletion doesn't have
any side-effects (because of triggers), so we can use optimized
any side-effects (because of triggers), so we can use optimized
handler::delete_all_rows() method.
handler::delete_all_rows() method.
We implement fast TRUNCATE for InnoDB even if triggers are present.
TRUNCATE ignores triggers.
*/
*/
if
(
!
using_limit
&&
const_cond
&&
(
!
conds
||
conds
->
val_int
())
&&
if
(
!
using_limit
&&
const_cond
&&
(
!
conds
||
conds
->
val_int
())
&&
!
(
specialflag
&
(
SPECIAL_NO_NEW_FUNC
|
SPECIAL_SAFE_MODE
))
&&
!
(
specialflag
&
(
SPECIAL_NO_NEW_FUNC
|
SPECIAL_SAFE_MODE
))
&&
!
(
table
->
triggers
&&
table
->
triggers
->
has_delete_triggers
()))
(
thd
->
lex
->
sql_command
==
SQLCOM_TRUNCATE
||
!
(
table
->
triggers
&&
table
->
triggers
->
has_delete_triggers
()))
)
{
{
deleted
=
table
->
file
->
records
;
deleted
=
table
->
file
->
records
;
if
(
!
(
error
=
table
->
file
->
delete_all_rows
()))
if
(
!
(
error
=
table
->
file
->
delete_all_rows
()))
...
...
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