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
c0badf88
Commit
c0badf88
authored
Jan 24, 2012
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Plain Diff
Merging BUG#13458237 from 5.1.
parents
825c74f6
f8e924b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
276 additions
and
3 deletions
+276
-3
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+213
-1
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+61
-0
sql-common/my_time.c
sql-common/my_time.c
+1
-1
sql/item_timefunc.cc
sql/item_timefunc.cc
+1
-1
No files found.
mysql-test/r/func_time.result
View file @
c0badf88
...
...
@@ -1402,8 +1402,220 @@ NULL
# Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0,
#
DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
#
# BUG#13458237 INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY
# SIMILAR TO '2009-10-00'
#
SELECT
DATE('20091000'),
STR_TO_DATE('200910','%Y%m'),
LAST_DAY('2009-10-00'),
LAST_DAY(DATE('2009-10-00')),
LAST_DAY(DATE'2009-10-00'),
LAST_DAY(STR_TO_DATE('200910','%Y%m')),
WEEK('2009-10-00'),
WEEK(DATE('2009-10-00')),
WEEK(DATE'2009-10-00'),
WEEK(STR_TO_DATE('200910','%Y%m')),
WEEKOFYEAR('2009-10-00'),
WEEKOFYEAR(DATE('2009-10-00')),
WEEKOFYEAR(DATE'2009-10-00'),
WEEKOFYEAR(STR_TO_DATE('200910','%Y%m')),
DAYOFYEAR('2009-10-00'),
DAYOFYEAR(DATE('2009-10-00')),
DAYOFYEAR(DATE'2009-10-00'),
DAYOFYEAR(STR_TO_DATE('200910','%Y%m')),
WEEKDAY('2009-10-00'),
WEEKDAY(DATE('2009-10-00')),
WEEKDAY(DATE'2009-10-00'),
WEEKDAY(STR_TO_DATE('200910','%Y%m')),
TO_DAYs('2009-10-00'),
TO_DAYs(DATE('2009-10-00')),
TO_DAYs(DATE'2009-10-00'),
TO_DAYs(STR_TO_DATE('200910','%Y%m'));
DATE('20091000') 2009-10-00
STR_TO_DATE('200910','%Y%m') 2009-10-00
LAST_DAY('2009-10-00') NULL
LAST_DAY(DATE('2009-10-00')) 2009-10-31
LAST_DAY(DATE'2009-10-00') NULL
LAST_DAY(STR_TO_DATE('200910','%Y%m')) 2009-10-31
WEEK('2009-10-00') NULL
WEEK(DATE('2009-10-00')) 39
WEEK(DATE'2009-10-00') NULL
WEEK(STR_TO_DATE('200910','%Y%m')) NULL
WEEKOFYEAR('2009-10-00') NULL
WEEKOFYEAR(DATE('2009-10-00')) 40
WEEKOFYEAR(DATE'2009-10-00') NULL
WEEKOFYEAR(STR_TO_DATE('200910','%Y%m')) NULL
DAYOFYEAR('2009-10-00') NULL
DAYOFYEAR(DATE('2009-10-00')) 273
DAYOFYEAR(DATE'2009-10-00') NULL
DAYOFYEAR(STR_TO_DATE('200910','%Y%m')) NULL
WEEKDAY('2009-10-00') NULL
WEEKDAY(DATE('2009-10-00')) 2
WEEKDAY(DATE'2009-10-00') NULL
WEEKDAY(STR_TO_DATE('200910','%Y%m')) NULL
TO_DAYs('2009-10-00') NULL
TO_DAYs(DATE('2009-10-00')) 734045
TO_DAYs(DATE'2009-10-00') NULL
TO_DAYs(STR_TO_DATE('200910','%Y%m')) NULL
Warnings:
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
SELECT
DATE('00000100'),
STR_TO_DATE('000001','%Y%m'),
LAST_DAY('0000-01-00'),
LAST_DAY(DATE('0000-01-00')),
LAST_DAY(DATE'0000-01-00'),
LAST_DAY(STR_TO_DATE('000001','%Y%m')),
WEEK('0000-01-00'),
WEEK(DATE('0000-01-00')),
WEEK(DATE'0000-01-00'),
WEEK(STR_TO_DATE('000001','%Y%m')),
WEEKOFYEAR('0000-01-00'),
WEEKOFYEAR(DATE('0000-01-00')),
WEEKOFYEAR(DATE'0000-01-00'),
WEEKOFYEAR(STR_TO_DATE('000001','%Y%m')),
DAYOFYEAR('0000-01-00'),
DAYOFYEAR(DATE('0000-01-00')),
DAYOFYEAR(DATE'0000-01-00'),
DAYOFYEAR(STR_TO_DATE('000001','%Y%m')),
WEEKDAY('0000-01-00'),
WEEKDAY(DATE('0000-01-00')),
WEEKDAY(DATE'0000-01-00'),
WEEKDAY(STR_TO_DATE('000001','%Y%m')),
TO_DAYs('0000-01-00'),
TO_DAYs(DATE('0000-01-00')),
TO_DAYs(DATE'0000-01-00'),
TO_DAYs(STR_TO_DATE('000001','%Y%m'));
DATE('00000100') 0000-01-00
STR_TO_DATE('000001','%Y%m') 0000-01-00
LAST_DAY('0000-01-00') NULL
LAST_DAY(DATE('0000-01-00')) 0000-01-31
LAST_DAY(DATE'0000-01-00') NULL
LAST_DAY(STR_TO_DATE('000001','%Y%m')) 0000-01-31
WEEK('0000-01-00') NULL
WEEK(DATE('0000-01-00')) 52
WEEK(DATE'0000-01-00') NULL
WEEK(STR_TO_DATE('000001','%Y%m')) NULL
WEEKOFYEAR('0000-01-00') NULL
WEEKOFYEAR(DATE('0000-01-00')) 52
WEEKOFYEAR(DATE'0000-01-00') NULL
WEEKOFYEAR(STR_TO_DATE('000001','%Y%m')) NULL
DAYOFYEAR('0000-01-00') NULL
DAYOFYEAR(DATE('0000-01-00')) 0
DAYOFYEAR(DATE'0000-01-00') NULL
DAYOFYEAR(STR_TO_DATE('000001','%Y%m')) NULL
WEEKDAY('0000-01-00') NULL
WEEKDAY(DATE('0000-01-00')) 5
WEEKDAY(DATE'0000-01-00') NULL
WEEKDAY(STR_TO_DATE('000001','%Y%m')) NULL
TO_DAYs('0000-01-00') NULL
TO_DAYs(DATE('0000-01-00')) 0
TO_DAYs(DATE'0000-01-00') NULL
TO_DAYs(STR_TO_DATE('000001','%Y%m')) NULL
Warnings:
Warning 1292 Incorrect datetime value: '0'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
End of 5.1 tests
#
# Bug#57039: constant subtime expression returns incorrect result.
...
...
mysql-test/t/func_time.test
View file @
c0badf88
...
...
@@ -915,6 +915,67 @@ SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
DO
WEEK
((
DATE_ADD
((
CAST
(
0
AS
DATE
)),
INTERVAL
1
YEAR_MONTH
)),
5
);
--
echo
#
--
echo
# BUG#13458237 INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY
--
echo
# SIMILAR TO '2009-10-00'
--
echo
#
query_vertical
SELECT
DATE
(
'20091000'
),
STR_TO_DATE
(
'200910'
,
'%Y%m'
),
LAST_DAY
(
'2009-10-00'
),
LAST_DAY
(
DATE
(
'2009-10-00'
)),
LAST_DAY
(
DATE
'2009-10-00'
),
LAST_DAY
(
STR_TO_DATE
(
'200910'
,
'%Y%m'
)),
WEEK
(
'2009-10-00'
),
WEEK
(
DATE
(
'2009-10-00'
)),
WEEK
(
DATE
'2009-10-00'
),
WEEK
(
STR_TO_DATE
(
'200910'
,
'%Y%m'
)),
WEEKOFYEAR
(
'2009-10-00'
),
WEEKOFYEAR
(
DATE
(
'2009-10-00'
)),
WEEKOFYEAR
(
DATE
'2009-10-00'
),
WEEKOFYEAR
(
STR_TO_DATE
(
'200910'
,
'%Y%m'
)),
DAYOFYEAR
(
'2009-10-00'
),
DAYOFYEAR
(
DATE
(
'2009-10-00'
)),
DAYOFYEAR
(
DATE
'2009-10-00'
),
DAYOFYEAR
(
STR_TO_DATE
(
'200910'
,
'%Y%m'
)),
WEEKDAY
(
'2009-10-00'
),
WEEKDAY
(
DATE
(
'2009-10-00'
)),
WEEKDAY
(
DATE
'2009-10-00'
),
WEEKDAY
(
STR_TO_DATE
(
'200910'
,
'%Y%m'
)),
TO_DAYs
(
'2009-10-00'
),
TO_DAYs
(
DATE
(
'2009-10-00'
)),
TO_DAYs
(
DATE
'2009-10-00'
),
TO_DAYs
(
STR_TO_DATE
(
'200910'
,
'%Y%m'
));
query_vertical
SELECT
DATE
(
'00000100'
),
STR_TO_DATE
(
'000001'
,
'%Y%m'
),
LAST_DAY
(
'0000-01-00'
),
LAST_DAY
(
DATE
(
'0000-01-00'
)),
LAST_DAY
(
DATE
'0000-01-00'
),
LAST_DAY
(
STR_TO_DATE
(
'000001'
,
'%Y%m'
)),
WEEK
(
'0000-01-00'
),
WEEK
(
DATE
(
'0000-01-00'
)),
WEEK
(
DATE
'0000-01-00'
),
WEEK
(
STR_TO_DATE
(
'000001'
,
'%Y%m'
)),
WEEKOFYEAR
(
'0000-01-00'
),
WEEKOFYEAR
(
DATE
(
'0000-01-00'
)),
WEEKOFYEAR
(
DATE
'0000-01-00'
),
WEEKOFYEAR
(
STR_TO_DATE
(
'000001'
,
'%Y%m'
)),
DAYOFYEAR
(
'0000-01-00'
),
DAYOFYEAR
(
DATE
(
'0000-01-00'
)),
DAYOFYEAR
(
DATE
'0000-01-00'
),
DAYOFYEAR
(
STR_TO_DATE
(
'000001'
,
'%Y%m'
)),
WEEKDAY
(
'0000-01-00'
),
WEEKDAY
(
DATE
(
'0000-01-00'
)),
WEEKDAY
(
DATE
'0000-01-00'
),
WEEKDAY
(
STR_TO_DATE
(
'000001'
,
'%Y%m'
)),
TO_DAYs
(
'0000-01-00'
),
TO_DAYs
(
DATE
(
'0000-01-00'
)),
TO_DAYs
(
DATE
'0000-01-00'
),
TO_DAYs
(
STR_TO_DATE
(
'000001'
,
'%Y%m'
));
--
echo
End
of
5.1
tests
--
echo
#
...
...
sql-common/my_time.c
View file @
c0badf88
...
...
@@ -783,7 +783,7 @@ long calc_daynr(uint year,uint month,uint day)
temp
=
(
int
)
((
y
/
100
+
1
)
*
3
)
/
4
;
DBUG_PRINT
(
"exit"
,(
"year: %d month: %d day: %d -> daynr: %ld"
,
y
+
(
month
<=
2
),
month
,
day
,
delsum
+
y
/
4
-
temp
));
DBUG_ASSERT
(
delsum
+
(
int
)
y
/
4
-
temp
>
0
);
DBUG_ASSERT
(
delsum
+
(
int
)
y
/
4
-
temp
>
=
0
);
DBUG_RETURN
(
delsum
+
(
int
)
y
/
4
-
temp
);
}
/* calc_daynr */
...
...
sql/item_timefunc.cc
View file @
c0badf88
...
...
@@ -2747,7 +2747,7 @@ String *Item_time_typecast::val_str(String *str)
bool
Item_date_typecast
::
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzy_date
)
{
bool
res
=
get_arg0_date
(
ltime
,
fuzzy_date
);
bool
res
=
get_arg0_date
(
ltime
,
TIME_FUZZY_DATE
);
ltime
->
hour
=
ltime
->
minute
=
ltime
->
second
=
ltime
->
second_part
=
0
;
ltime
->
time_type
=
MYSQL_TIMESTAMP_DATE
;
return
res
;
...
...
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