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
836275bb
Commit
836275bb
authored
Nov 17, 2015
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-4829 BEFORE INSERT triggers dont issue 1406 error.
Turn the 'abort_on_warning' on for assigning value to fields.
parent
905613f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
0 deletions
+40
-0
mysql-test/r/trigger.result
mysql-test/r/trigger.result
+15
-0
mysql-test/t/trigger.test
mysql-test/t/trigger.test
+22
-0
sql/sp_head.cc
sql/sp_head.cc
+3
-0
No files found.
mysql-test/r/trigger.result
View file @
836275bb
...
...
@@ -2273,3 +2273,18 @@ SET optimizer_switch=@save_optimizer_switch;
DROP TRIGGER tr;
DROP TABLE t1, t2;
End of 5.3 tests.
SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
CREATE TABLE t1 (c CHAR(1) NOT NULL);
CREATE TRIGGER t1_bi
BEFORE INSERT
ON t1
FOR EACH ROW
BEGIN
SET NEW.c = 'www';
END;
|
SET @@session.sql_mode = default;
INSERT INTO t1 VALUES ('a');
ERROR 22001: Data too long for column 'c' at row 1
DROP TRIGGER t1_bi;
DROP TABLE t1;
mysql-test/t/trigger.test
View file @
836275bb
...
...
@@ -2613,3 +2613,25 @@ DROP TABLE t1, t2;
--
echo
End
of
5.3
tests
.
#
# MDEV-4829 BEFORE INSERT triggers dont issue 1406 error
#
SET
@@
session
.
sql_mode
=
'STRICT_ALL_TABLES,STRICT_TRANS_TABLES'
;
CREATE
TABLE
t1
(
c
CHAR
(
1
)
NOT
NULL
);
DELIMITER
|
;
CREATE
TRIGGER
t1_bi
BEFORE
INSERT
ON
t1
FOR
EACH
ROW
BEGIN
SET
NEW
.
c
=
'www'
;
END
;
|
DELIMITER
;
|
SET
@@
session
.
sql_mode
=
default
;
--
error
ER_DATA_TOO_LONG
INSERT
INTO
t1
VALUES
(
'a'
);
DROP
TRIGGER
t1_bi
;
DROP
TABLE
t1
;
sql/sp_head.cc
View file @
836275bb
...
...
@@ -3229,7 +3229,10 @@ sp_instr_set_trigger_field::execute(THD *thd, uint *nextp)
int
sp_instr_set_trigger_field
::
exec_core
(
THD
*
thd
,
uint
*
nextp
)
{
bool
sav_abort_on_warning
=
thd
->
abort_on_warning
;
thd
->
abort_on_warning
=
thd
->
is_strict_mode
()
&&
!
thd
->
lex
->
ignore
;
const
int
res
=
(
trigger_field
->
set_value
(
thd
,
&
value
)
?
-
1
:
0
);
thd
->
abort_on_warning
=
sav_abort_on_warning
;
*
nextp
=
m_ip
+
1
;
return
res
;
}
...
...
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