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
fff7fc50
Commit
fff7fc50
authored
Nov 07, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-10817 CAST(MAX(DATE'2001-01-01') AS TIME) returns a wrong result
parent
8128ae48
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
0 deletions
+45
-0
mysql-test/r/type_time.result
mysql-test/r/type_time.result
+14
-0
mysql-test/t/type_time.test
mysql-test/t/type_time.test
+11
-0
sql/item_func.h
sql/item_func.h
+7
-0
sql/item_sum.cc
sql/item_sum.cc
+12
-0
sql/item_sum.h
sql/item_sum.h
+1
-0
No files found.
mysql-test/r/type_time.result
View file @
fff7fc50
...
@@ -1245,5 +1245,19 @@ a b c
...
@@ -1245,5 +1245,19 @@ a b c
2070 00:00:00 00:00:00
2070 00:00:00 00:00:00
DROP TABLE t1,t2;
DROP TABLE t1,t2;
#
#
# MDEV-10817 CAST(MAX(DATE'2001-01-01') AS TIME) returns a wrong result
#
SELECT CAST(DATE'2001-01-01' AS TIME);
CAST(DATE'2001-01-01' AS TIME)
00:00:00
SELECT CAST(MAX(DATE'2001-01-01') AS TIME);
CAST(MAX(DATE'2001-01-01') AS TIME)
00:00:00
CREATE FUNCTION f1() RETURNS DATE RETURN DATE'2001-01-01';
SELECT CAST(f1() AS TIME);
CAST(f1() AS TIME)
00:00:00
DROP FUNCTION f1;
#
# End of 10.2 tests
# End of 10.2 tests
#
#
mysql-test/t/type_time.test
View file @
fff7fc50
...
@@ -746,6 +746,17 @@ SELECT * FROM t1;
...
@@ -746,6 +746,17 @@ SELECT * FROM t1;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-10817 CAST(MAX(DATE'2001-01-01') AS TIME) returns a wrong result
--
echo
#
SELECT
CAST
(
DATE
'2001-01-01'
AS
TIME
);
SELECT
CAST
(
MAX
(
DATE
'2001-01-01'
)
AS
TIME
);
CREATE
FUNCTION
f1
()
RETURNS
DATE
RETURN
DATE
'2001-01-01'
;
SELECT
CAST
(
f1
()
AS
TIME
);
DROP
FUNCTION
f1
;
--
echo
#
--
echo
#
--
echo
# End of 10.2 tests
--
echo
# End of 10.2 tests
--
echo
#
--
echo
#
sql/item_func.h
View file @
fff7fc50
...
@@ -2367,6 +2367,13 @@ class Item_func_sp :public Item_func
...
@@ -2367,6 +2367,13 @@ class Item_func_sp :public Item_func
return
sp_result_field
->
val_decimal
(
dec_buf
);
return
sp_result_field
->
val_decimal
(
dec_buf
);
}
}
bool
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
if
(
execute
())
return
true
;
return
sp_result_field
->
get_date
(
ltime
,
fuzzydate
);
}
String
*
val_str
(
String
*
str
)
String
*
val_str
(
String
*
str
)
{
{
String
buf
;
String
buf
;
...
...
sql/item_sum.cc
View file @
fff7fc50
...
@@ -2065,6 +2065,18 @@ void Item_sum_hybrid::clear()
...
@@ -2065,6 +2065,18 @@ void Item_sum_hybrid::clear()
null_value
=
1
;
null_value
=
1
;
}
}
bool
Item_sum_hybrid
::
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
DBUG_ASSERT
(
fixed
==
1
);
if
(
null_value
)
return
0
;
bool
retval
=
value
->
get_date
(
ltime
,
fuzzydate
);
if
((
null_value
=
value
->
null_value
))
DBUG_ASSERT
(
retval
==
true
);
return
retval
;
}
double
Item_sum_hybrid
::
val_real
()
double
Item_sum_hybrid
::
val_real
()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
...
...
sql/item_sum.h
View file @
fff7fc50
...
@@ -1037,6 +1037,7 @@ class Item_sum_hybrid :public Item_sum, public Type_handler_hybrid_field_type
...
@@ -1037,6 +1037,7 @@ class Item_sum_hybrid :public Item_sum, public Type_handler_hybrid_field_type
double
val_real
();
double
val_real
();
longlong
val_int
();
longlong
val_int
();
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
bool
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
);
void
reset_field
();
void
reset_field
();
String
*
val_str
(
String
*
);
String
*
val_str
(
String
*
);
bool
keep_field_type
(
void
)
const
{
return
1
;
}
bool
keep_field_type
(
void
)
const
{
return
1
;
}
...
...
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