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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d1adae37
Commit
d1adae37
authored
Aug 22, 2013
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merging from 5.3
pending merges: Alexander Barkov 2013-08-22 MDEV-4804 Date comparing false result
parents
f5ea23b6
c40de1df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
3 deletions
+63
-3
mysql-test/r/type_date.result
mysql-test/r/type_date.result
+38
-0
mysql-test/t/type_date.test
mysql-test/t/type_date.test
+22
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+3
-3
No files found.
mysql-test/r/type_date.result
View file @
d1adae37
...
...
@@ -311,6 +311,44 @@ NULL
Warnings:
Warning 1292 Incorrect datetime value: '2022-00-00 00:00:00'
#
# MDEV-4804 Date comparing false result
#
SET @h0="20111107";
SET @h1="0";
SET @@timestamp=UNIX_TIMESTAMP('2013-08-19 20:30:00');
SELECT
COALESCE(DATE(@h0),DATE("1901-01-01")) AS h0d,
COALESCE(DATE(@h1),DATE(NOW())) AS h1d,
COALESCE(DATE(@h0),DATE("1901-01-01"))>COALESCE(DATE(@h1),DATE(NOW())) AS compare_h0_gt_h1;
h0d h1d compare_h0_gt_h1
2011-11-07 2013-08-19 0
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
SELECT
DATE('20011107'),
DATE('0'),
COALESCE(DATE('0'),CURRENT_DATE) AS d1,
DATE('20011107')>COALESCE(DATE('0'),CURRENT_DATE) AS cmp;
DATE('20011107') DATE('0') d1 cmp
2001-11-07 NULL 2013-08-19 0
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
SELECT
DATE('20011107'),
DATE('0'),
IFNULL(DATE('0'),CURRENT_DATE) AS d1,
DATE('20011107')>IFNULL(DATE('0'),CURRENT_DATE) AS cmp;
DATE('20011107') DATE('0') d1 cmp
2001-11-07 NULL 2013-08-19 0
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
SET @@timestamp=DEFAULT;
#
# End of 5.3 tests
#
#
...
...
mysql-test/t/type_date.test
View file @
d1adae37
...
...
@@ -299,6 +299,28 @@ drop table t1;
--
echo
#
SELECT
CONVERT_TZ
(
GREATEST
(
DATE
(
'2021-00-00'
),
DATE
(
'2022-00-00'
)),
'+00:00'
,
'+7:5'
);
--
echo
#
--
echo
# MDEV-4804 Date comparing false result
--
echo
#
SET
@
h0
=
"20111107"
;
SET
@
h1
=
"0"
;
SET
@@
timestamp
=
UNIX_TIMESTAMP
(
'2013-08-19 20:30:00'
);
SELECT
COALESCE
(
DATE
(
@
h0
),
DATE
(
"1901-01-01"
))
AS
h0d
,
COALESCE
(
DATE
(
@
h1
),
DATE
(
NOW
()))
AS
h1d
,
COALESCE
(
DATE
(
@
h0
),
DATE
(
"1901-01-01"
))
>
COALESCE
(
DATE
(
@
h1
),
DATE
(
NOW
()))
AS
compare_h0_gt_h1
;
SELECT
DATE
(
'20011107'
),
DATE
(
'0'
),
COALESCE
(
DATE
(
'0'
),
CURRENT_DATE
)
AS
d1
,
DATE
(
'20011107'
)
>
COALESCE
(
DATE
(
'0'
),
CURRENT_DATE
)
AS
cmp
;
SELECT
DATE
(
'20011107'
),
DATE
(
'0'
),
IFNULL
(
DATE
(
'0'
),
CURRENT_DATE
)
AS
d1
,
DATE
(
'20011107'
)
>
IFNULL
(
DATE
(
'0'
),
CURRENT_DATE
)
AS
cmp
;
SET
@@
timestamp
=
DEFAULT
;
--
echo
#
--
echo
# End of 5.3 tests
--
echo
#
...
...
sql/item_cmpfunc.cc
View file @
d1adae37
...
...
@@ -3238,12 +3238,12 @@ bool Item_func_coalesce::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
null_value
=
0
;
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
bool
res
=
args
[
i
]
->
get_date
(
ltime
,
fuzzydate
);
bool
res
=
args
[
i
]
->
get_date
(
ltime
,
fuzzydate
&
~
TIME_FUZZY_DATES
);
if
(
!
args
[
i
]
->
null_value
)
return
res
;
}
null_value
=
1
;
return
1
;
bzero
((
char
*
)
ltime
,
sizeof
(
*
ltime
))
;
return
null_value
|=
!
(
fuzzydate
&
TIME_FUZZY_DATES
)
;
}
...
...
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