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
a5e2a14e
Commit
a5e2a14e
authored
Nov 07, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17634 Regression: TIME(0)=TIME('z') returns NULL vs 1
parent
41e68e8e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
3 deletions
+42
-3
mysql-test/main/type_time.result
mysql-test/main/type_time.result
+23
-0
mysql-test/main/type_time.test
mysql-test/main/type_time.test
+12
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+3
-3
sql/sql_type.h
sql/sql_type.h
+4
-0
No files found.
mysql-test/main/type_time.result
View file @
a5e2a14e
...
@@ -2094,5 +2094,28 @@ SELECT TIME(99991231235957), TIME(99991231235958), TIME(99991231235959);
...
@@ -2094,5 +2094,28 @@ SELECT TIME(99991231235957), TIME(99991231235958), TIME(99991231235959);
TIME(99991231235957) TIME(99991231235958) TIME(99991231235959)
TIME(99991231235957) TIME(99991231235958) TIME(99991231235959)
23:59:57 23:59:58 23:59:59
23:59:57 23:59:58 23:59:59
#
#
# MDEV-17634 Regression: TIME(0)=TIME('z') returns NULL vs 1
#
SELECT
TIMESTAMP(0)=TIMESTAMP('z') AS ts,
DATE(0)=DATE('z') AS d,
TIME(0)=TIME('z') AS t;
ts d t
1 1 1
Warnings:
Warning 1292 Incorrect datetime value: 'z'
Warning 1292 Incorrect datetime value: 'z'
Warning 1292 Truncated incorrect time value: 'z'
SELECT
TIMESTAMP(0)=TIMESTAMP('') AS ts,
DATE(0)=DATE('') AS d,
TIME(0)=TIME('') AS t;
ts d t
1 1 1
Warnings:
Warning 1292 Incorrect datetime value: ''
Warning 1292 Incorrect datetime value: ''
Warning 1292 Truncated incorrect time value: ''
#
# End of 10.4 tests
# End of 10.4 tests
#
#
mysql-test/main/type_time.test
View file @
a5e2a14e
...
@@ -1366,6 +1366,18 @@ SET optimizer_use_condition_selectivity=DEFAULT;
...
@@ -1366,6 +1366,18 @@ SET optimizer_use_condition_selectivity=DEFAULT;
--
echo
#
--
echo
#
SELECT
TIME
(
99991231235957
),
TIME
(
99991231235958
),
TIME
(
99991231235959
);
SELECT
TIME
(
99991231235957
),
TIME
(
99991231235958
),
TIME
(
99991231235959
);
--
echo
#
--
echo
# MDEV-17634 Regression: TIME(0)=TIME('z') returns NULL vs 1
--
echo
#
SELECT
TIMESTAMP
(
0
)
=
TIMESTAMP
(
'z'
)
AS
ts
,
DATE
(
0
)
=
DATE
(
'z'
)
AS
d
,
TIME
(
0
)
=
TIME
(
'z'
)
AS
t
;
SELECT
TIMESTAMP
(
0
)
=
TIMESTAMP
(
''
)
AS
ts
,
DATE
(
0
)
=
DATE
(
''
)
AS
d
,
TIME
(
0
)
=
TIME
(
''
)
AS
t
;
--
echo
#
--
echo
#
--
echo
# End of 10.4 tests
--
echo
# End of 10.4 tests
...
...
sql/item_timefunc.cc
View file @
a5e2a14e
...
@@ -2416,10 +2416,10 @@ void Item_char_typecast::fix_length_and_dec_internal(CHARSET_INFO *from_cs)
...
@@ -2416,10 +2416,10 @@ void Item_char_typecast::fix_length_and_dec_internal(CHARSET_INFO *from_cs)
}
}
bool
Item_time_typecast
::
get_date
(
THD
*
thd
,
MYSQL_TIME
*
ltime
,
date_mode_t
fuzzydat
e
)
bool
Item_time_typecast
::
get_date
(
THD
*
thd
,
MYSQL_TIME
*
to
,
date_mode_t
mod
e
)
{
{
Time
*
tm
=
new
(
ltime
)
Time
(
thd
,
args
[
0
],
Time
::
Options_for_cast
(
),
Time
*
tm
=
new
(
to
)
Time
(
thd
,
args
[
0
],
Time
::
Options_for_cast
(
mode
),
MY_MIN
(
decimals
,
TIME_SECOND_PART_DIGITS
));
MY_MIN
(
decimals
,
TIME_SECOND_PART_DIGITS
));
return
(
null_value
=
!
tm
->
is_valid_time
());
return
(
null_value
=
!
tm
->
is_valid_time
());
}
}
...
...
sql/sql_type.h
View file @
a5e2a14e
...
@@ -790,6 +790,10 @@ class Time: public Temporal
...
@@ -790,6 +790,10 @@ class Time: public Temporal
Options_for_cast
()
Options_for_cast
()
:
Options
(
flags_for_get_date
(),
DATETIME_TO_TIME_YYYYMMDD_TRUNCATE
)
:
Options
(
flags_for_get_date
(),
DATETIME_TO_TIME_YYYYMMDD_TRUNCATE
)
{
}
{
}
Options_for_cast
(
date_mode_t
mode
)
:
Options
(
flags_for_get_date
()
|
(
mode
&
TIME_FUZZY_DATES
),
DATETIME_TO_TIME_YYYYMMDD_TRUNCATE
)
{
}
};
};
private:
private:
bool
is_valid_value_slow
()
const
bool
is_valid_value_slow
()
const
...
...
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