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
780d7710
Commit
780d7710
authored
Mar 29, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17969 Assertion `name' failed in THD::push_warning_truncated_value_for_field
parent
a5ac029f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
3 deletions
+61
-3
mysql-test/main/type_temporal_innodb.result
mysql-test/main/type_temporal_innodb.result
+12
-0
mysql-test/main/type_temporal_innodb.test
mysql-test/main/type_temporal_innodb.test
+15
-0
mysql-test/main/type_timestamp.result
mysql-test/main/type_timestamp.result
+9
-0
mysql-test/main/type_timestamp.test
mysql-test/main/type_timestamp.test
+13
-0
sql/field.cc
sql/field.cc
+12
-3
No files found.
mysql-test/main/type_temporal_innodb.result
View file @
780d7710
...
...
@@ -160,3 +160,15 @@ SELECT * FROM t1 WHERE LEAST( UTC_TIME(), d );
d
2012-12-21
DROP TABLE t1;
#
# MDEV-17969 Assertion `name' failed in THD::push_warning_truncated_value_for_field
#
CREATE TABLE t1 (c1 DATE , c2 TIMESTAMP) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('2006-07-17','0000-00-00 00:00:00');
CREATE TABLE t2 (pk INT, a1 TIME) Engine=InnoDB;
INSERT INTO t2 VALUES (6,'00:00:00');
SET SESSION sql_mode= 'strict_all_tables,no_zero_date';
CREATE TABLE tbl SELECT * FROM t1 WHERE t1.c1 = (SELECT c2 FROM t2 WHERE pk = 6);
ERROR 22007: Truncated incorrect datetime value: '0000-00-00 00:00:00'
DROP TABLE t1,t2;
SET sql_mode=DEFAULT;
mysql-test/main/type_temporal_innodb.test
View file @
780d7710
...
...
@@ -66,3 +66,18 @@ CREATE TABLE t1 (d DATE) ENGINE=InnoDB;
INSERT
INTO
t1
VALUES
(
'2012-12-21'
);
SELECT
*
FROM
t1
WHERE
LEAST
(
UTC_TIME
(),
d
);
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-17969 Assertion `name' failed in THD::push_warning_truncated_value_for_field
--
echo
#
CREATE
TABLE
t1
(
c1
DATE
,
c2
TIMESTAMP
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
'2006-07-17'
,
'0000-00-00 00:00:00'
);
CREATE
TABLE
t2
(
pk
INT
,
a1
TIME
)
Engine
=
InnoDB
;
INSERT
INTO
t2
VALUES
(
6
,
'00:00:00'
);
SET
SESSION
sql_mode
=
'strict_all_tables,no_zero_date'
;
--
error
ER_TRUNCATED_WRONG_VALUE
CREATE
TABLE
tbl
SELECT
*
FROM
t1
WHERE
t1
.
c1
=
(
SELECT
c2
FROM
t2
WHERE
pk
=
6
);
# ^^^ there is no column c2 in table t2
DROP
TABLE
t1
,
t2
;
SET
sql_mode
=
DEFAULT
;
mysql-test/main/type_timestamp.result
View file @
780d7710
...
...
@@ -1185,5 +1185,14 @@ c IN (GREATEST(a,b))
0
DROP TABLE t1;
#
# MDEV-17969 Assertion `name' failed in THD::push_warning_truncated_value_for_field
#
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('2018-01-01'),('2019-01-01');
SET SESSION SQL_MODE= 'STRICT_ALL_TABLES,NO_ZERO_DATE';
CREATE TABLE t2 SELECT 1 AS f FROM t1 GROUP BY FROM_DAYS(d);
ERROR 22007: Truncated incorrect date value: '0000-00-00'
DROP TABLE t1;
#
# End of 10.4 tests
#
mysql-test/main/type_timestamp.test
View file @
780d7710
...
...
@@ -773,6 +773,19 @@ INSERT INTO t1 VALUES (0,0,0);
SELECT
c
IN
(
GREATEST
(
a
,
b
))
FROM
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-17969 Assertion `name' failed in THD::push_warning_truncated_value_for_field
--
echo
#
CREATE
TABLE
t1
(
d
DATE
);
INSERT
INTO
t1
VALUES
(
'2018-01-01'
),(
'2019-01-01'
);
SET
SESSION
SQL_MODE
=
'STRICT_ALL_TABLES,NO_ZERO_DATE'
;
--
error
ER_TRUNCATED_WRONG_VALUE
CREATE
TABLE
t2
SELECT
1
AS
f
FROM
t1
GROUP
BY
FROM_DAYS
(
d
);
DROP
TABLE
t1
;
--
echo
#
--
echo
# End of 10.4 tests
--
echo
#
sql/field.cc
View file @
780d7710
...
...
@@ -11010,9 +11010,18 @@ void Field::set_datetime_warning(Sql_condition::enum_warning_level level,
{
THD
*
thd
=
get_thd
();
if
(
thd
->
really_abort_on_warning
()
&&
level
>=
Sql_condition
::
WARN_LEVEL_WARN
)
thd
->
push_warning_truncated_value_for_field
(
level
,
typestr
,
str
->
ptr
(),
table
->
s
,
field_name
.
str
);
{
/*
field_str.name can be NULL when field is not in the select list:
SET SESSION SQL_MODE= 'STRICT_ALL_TABLES,NO_ZERO_DATE';
CREATE OR REPLACE TABLE t2 SELECT 1 AS f FROM t1 GROUP BY FROM_DAYS(d);
Can't call push_warning_truncated_value_for_field() directly here,
as it expect a non-NULL name.
*/
thd
->
push_warning_wrong_or_truncated_value
(
level
,
false
,
typestr
,
str
->
ptr
(),
table
->
s
,
field_name
.
str
);
}
else
set_warning
(
level
,
code
,
cuted_increment
);
}
...
...
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