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
a76a2522
Commit
a76a2522
authored
Dec 22, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP
parent
9c28fd7a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
mysql-test/r/ps.result
mysql-test/r/ps.result
+29
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+34
-0
sql/sql_prepare.cc
sql/sql_prepare.cc
+12
-0
No files found.
mysql-test/r/ps.result
View file @
a76a2522
...
...
@@ -5074,3 +5074,32 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
DROP PROCEDURE p1;
#
# MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP
#
CREATE PROCEDURE p1(OUT a VARCHAR(20))
BEGIN
SET a=10;
END;
$$
BEGIN NOT ATOMIC
DECLARE a DATETIME;
CALL p1(a);
END;
$$
ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
BEGIN NOT ATOMIC
DECLARE a DATETIME;
EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
END;
$$
ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
BEGIN NOT ATOMIC
DECLARE a DATETIME;
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING a;
DEALLOCATE PREPARE stmt;
END;
$$
ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
DROP PROCEDURE p1;
mysql-test/t/ps.test
View file @
a76a2522
...
...
@@ -4529,3 +4529,37 @@ CREATE TABLE t1 AS SELECT @a AS a, @b AS b;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
DROP
PROCEDURE
p1
;
--
echo
#
--
echo
# MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP
--
echo
#
DELIMITER
$$
;
CREATE
PROCEDURE
p1
(
OUT
a
VARCHAR
(
20
))
BEGIN
SET
a
=
10
;
END
;
$$
--
error
ER_TRUNCATED_WRONG_VALUE
BEGIN
NOT
ATOMIC
DECLARE
a
DATETIME
;
CALL
p1
(
a
);
END
;
$$
--
error
ER_TRUNCATED_WRONG_VALUE
BEGIN
NOT
ATOMIC
DECLARE
a
DATETIME
;
EXECUTE
IMMEDIATE
'CALL p1(?)'
USING
a
;
END
;
$$
--
error
ER_TRUNCATED_WRONG_VALUE
BEGIN
NOT
ATOMIC
DECLARE
a
DATETIME
;
PREPARE
stmt
FROM
'CALL p1(?)'
;
EXECUTE
stmt
USING
a
;
DEALLOCATE
PREPARE
stmt
;
END
;
$$
DELIMITER
;
$$
DROP
PROCEDURE
p1
;
sql/sql_prepare.cc
View file @
a76a2522
...
...
@@ -4786,7 +4786,19 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
if
(
error
==
0
&&
this
->
lex
->
sql_command
==
SQLCOM_CALL
)
{
if
(
is_sql_prepare
())
{
/*
Here we have the diagnostics area status already set to DA_OK.
sent_out_parameters() can raise errors when assigning OUT parameters:
DECLARE a DATETIME;
EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
when the procedure p1 assigns a DATETIME-incompatible value (e.g. 10)
to the out parameter. Allow to overwrite status (to DA_ERROR).
*/
thd
->
get_stmt_da
()
->
set_overwrite_status
(
true
);
thd
->
protocol_text
.
send_out_parameters
(
&
this
->
lex
->
param_list
);
thd
->
get_stmt_da
()
->
set_overwrite_status
(
false
);
}
else
thd
->
protocol
->
send_out_parameters
(
&
this
->
lex
->
param_list
);
}
...
...
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