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
7ea9d1e6
Commit
7ea9d1e6
authored
Jan 27, 2014
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(...):
Assertion `mon > 0 && mon < 13' failed.'
parent
669c6620
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
25 deletions
+63
-25
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+24
-0
mysql-test/r/type_date.result
mysql-test/r/type_date.result
+1
-1
mysql-test/r/type_time.result
mysql-test/r/type_time.result
+1
-1
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+11
-0
sql/item_func.cc
sql/item_func.cc
+7
-5
sql/item_timefunc.cc
sql/item_timefunc.cc
+4
-18
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/time.cc
sql/time.cc
+14
-0
No files found.
mysql-test/r/func_time.result
View file @
7ea9d1e6
...
@@ -2348,6 +2348,30 @@ SELECT EXTRACT(DAY FROM TIME('1 02:00:00')), EXTRACT(DAY FROM TIME('26:00:00'));
...
@@ -2348,6 +2348,30 @@ SELECT EXTRACT(DAY FROM TIME('1 02:00:00')), EXTRACT(DAY FROM TIME('26:00:00'));
EXTRACT(DAY FROM TIME('1 02:00:00')) EXTRACT(DAY FROM TIME('26:00:00'))
EXTRACT(DAY FROM TIME('1 02:00:00')) EXTRACT(DAY FROM TIME('26:00:00'))
1 1
1 1
#
#
# MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(int, int, int, int, int, int): Assertion `mon > 0 && mon < 13' failed.'
#
SET TIMESTAMP=UNIX_TIMESTAMP('2014-01-22 18:19:20');
CREATE TABLE t1 (t TIME);
INSERT INTO t1 VALUES ('03:22:30'),('18:30:05');
SELECT CONVERT_TZ(GREATEST(t, CURRENT_DATE()), '+02:00', '+10:00') FROM t1;
CONVERT_TZ(GREATEST(t, CURRENT_DATE()), '+02:00', '+10:00')
NULL
NULL
Warnings:
Warning 1292 Truncated incorrect time value: '1296:00:00'
Warning 1292 Incorrect datetime value: '838:59:59'
Warning 1292 Truncated incorrect time value: '1296:00:00'
Warning 1292 Incorrect datetime value: '838:59:59'
SELECT GREATEST(t, CURRENT_DATE()) FROM t1;
GREATEST(t, CURRENT_DATE())
838:59:59
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '1296:00:00'
Warning 1292 Truncated incorrect time value: '1296:00:00'
DROP TABLE t1;
SET TIMESTAMP=DEFAULT;
#
# MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP
# MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP
#
#
CREATE TABLE t1 (i INT);
CREATE TABLE t1 (i INT);
...
...
mysql-test/r/type_date.result
View file @
7ea9d1e6
...
@@ -305,7 +305,7 @@ SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5
...
@@ -305,7 +305,7 @@ SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5
CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5')
CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5')
NULL
NULL
Warnings:
Warnings:
Warning 1292 Incorrect datetime value: '2022-00-00
00:00:00
'
Warning 1292 Incorrect datetime value: '2022-00-00'
#
#
# MDEV-4804 Date comparing false result
# MDEV-4804 Date comparing false result
#
#
...
...
mysql-test/r/type_time.result
View file @
7ea9d1e6
...
@@ -180,7 +180,7 @@ SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5');
...
@@ -180,7 +180,7 @@ SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5');
CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5')
CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5')
NULL
NULL
Warnings:
Warnings:
Warning 1292 Incorrect datetime value: '00
00-00-00 00
:00:00'
Warning 1292 Incorrect datetime value: '00:00:00'
#
#
# MDEV-4652 Wrong result for CONCAT(GREATEST(TIME('00:00:01'),TIME('00:00:00')))
# MDEV-4652 Wrong result for CONCAT(GREATEST(TIME('00:00:01'),TIME('00:00:00')))
#
#
...
...
mysql-test/t/func_time.test
View file @
7ea9d1e6
...
@@ -1418,6 +1418,17 @@ SELECT EXTRACT(HOUR FROM TIME'1 02:00:00'), EXTRACT(HOUR FROM TIME'26:00:00');
...
@@ -1418,6 +1418,17 @@ SELECT EXTRACT(HOUR FROM TIME'1 02:00:00'), EXTRACT(HOUR FROM TIME'26:00:00');
SELECT
EXTRACT
(
HOUR
FROM
TIME
(
'1 02:00:00'
)),
EXTRACT
(
HOUR
FROM
TIME
(
'26:00:00'
));
SELECT
EXTRACT
(
HOUR
FROM
TIME
(
'1 02:00:00'
)),
EXTRACT
(
HOUR
FROM
TIME
(
'26:00:00'
));
SELECT
EXTRACT
(
DAY
FROM
TIME
(
'1 02:00:00'
)),
EXTRACT
(
DAY
FROM
TIME
(
'26:00:00'
));
SELECT
EXTRACT
(
DAY
FROM
TIME
(
'1 02:00:00'
)),
EXTRACT
(
DAY
FROM
TIME
(
'26:00:00'
));
--
echo
#
--
echo
# MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(int, int, int, int, int, int): Assertion `mon > 0 && mon < 13' failed.'
--
echo
#
SET
TIMESTAMP
=
UNIX_TIMESTAMP
(
'2014-01-22 18:19:20'
);
CREATE
TABLE
t1
(
t
TIME
);
INSERT
INTO
t1
VALUES
(
'03:22:30'
),(
'18:30:05'
);
SELECT
CONVERT_TZ
(
GREATEST
(
t
,
CURRENT_DATE
()),
'+02:00'
,
'+10:00'
)
FROM
t1
;
SELECT
GREATEST
(
t
,
CURRENT_DATE
())
FROM
t1
;
DROP
TABLE
t1
;
SET
TIMESTAMP
=
DEFAULT
;
--
echo
#
--
echo
#
--
echo
# MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP
--
echo
# MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP
...
...
sql/item_func.cc
View file @
7ea9d1e6
...
@@ -2635,11 +2635,6 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
...
@@ -2635,11 +2635,6 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
}
}
unpack_time
(
min_max
,
ltime
);
unpack_time
(
min_max
,
ltime
);
if
(
!
(
fuzzy_date
&
TIME_TIME_ONLY
)
&&
((
null_value
=
check_date_with_warn
(
ltime
,
fuzzy_date
,
MYSQL_TIMESTAMP_ERROR
))))
return
true
;
if
(
compare_as_dates
->
field_type
()
==
MYSQL_TYPE_DATE
)
if
(
compare_as_dates
->
field_type
()
==
MYSQL_TYPE_DATE
)
{
{
ltime
->
time_type
=
MYSQL_TIMESTAMP_DATE
;
ltime
->
time_type
=
MYSQL_TIMESTAMP_DATE
;
...
@@ -2650,8 +2645,15 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
...
@@ -2650,8 +2645,15 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
ltime
->
time_type
=
MYSQL_TIMESTAMP_TIME
;
ltime
->
time_type
=
MYSQL_TIMESTAMP_TIME
;
ltime
->
hour
+=
(
ltime
->
month
*
32
+
ltime
->
day
)
*
24
;
ltime
->
hour
+=
(
ltime
->
month
*
32
+
ltime
->
day
)
*
24
;
ltime
->
month
=
ltime
->
day
=
0
;
ltime
->
month
=
ltime
->
day
=
0
;
if
(
adjust_time_range_with_warn
(
ltime
,
min
(
decimals
,
TIME_SECOND_PART_DIGITS
)))
return
(
null_value
=
true
);
}
}
if
(
!
(
fuzzy_date
&
TIME_TIME_ONLY
)
&&
((
null_value
=
check_date_with_warn
(
ltime
,
fuzzy_date
,
MYSQL_TIMESTAMP_ERROR
))))
return
true
;
return
0
;
return
0
;
}
}
...
...
sql/item_timefunc.cc
View file @
7ea9d1e6
...
@@ -2448,7 +2448,7 @@ bool Item_func_add_time::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
...
@@ -2448,7 +2448,7 @@ bool Item_func_add_time::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
bool
is_time
=
0
;
bool
is_time
=
0
;
long
days
,
microseconds
;
long
days
,
microseconds
;
longlong
seconds
;
longlong
seconds
;
int
l_sign
=
sign
,
was_cut
=
0
;
int
l_sign
=
sign
;
if
(
is_date
)
// TIMESTAMP function
if
(
is_date
)
// TIMESTAMP function
{
{
...
@@ -2499,16 +2499,7 @@ bool Item_func_add_time::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
...
@@ -2499,16 +2499,7 @@ bool Item_func_add_time::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
}
}
ltime
->
hour
+=
days
*
24
;
ltime
->
hour
+=
days
*
24
;
return
(
null_value
=
adjust_time_range_with_warn
(
ltime
,
decimals
));
MYSQL_TIME
copy
=
*
ltime
;
Lazy_string_time
str
(
&
copy
);
check_time_range
(
ltime
,
decimals
,
&
was_cut
);
if
(
was_cut
)
make_truncated_value_warning
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
&
str
,
MYSQL_TIMESTAMP_TIME
,
NullS
);
return
(
null_value
=
0
);
}
}
...
@@ -2546,7 +2537,7 @@ bool Item_func_timediff::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
...
@@ -2546,7 +2537,7 @@ bool Item_func_timediff::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
longlong
seconds
;
longlong
seconds
;
long
microseconds
;
long
microseconds
;
int
l_sign
=
1
,
was_cut
=
0
;
int
l_sign
=
1
;
MYSQL_TIME
l_time1
,
l_time2
,
l_time3
;
MYSQL_TIME
l_time1
,
l_time2
,
l_time3
;
Lazy_string_time
str
(
&
l_time3
);
Lazy_string_time
str
(
&
l_time3
);
...
@@ -2590,12 +2581,7 @@ bool Item_func_timediff::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
...
@@ -2590,12 +2581,7 @@ bool Item_func_timediff::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
goto
null_date
;
goto
null_date
;
*
ltime
=
l_time3
;
*
ltime
=
l_time3
;
check_time_range
(
ltime
,
decimals
,
&
was_cut
);
return
(
null_value
=
adjust_time_range_with_warn
(
ltime
,
decimals
));
if
(
was_cut
)
make_truncated_value_warning
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
&
str
,
MYSQL_TIMESTAMP_TIME
,
NullS
);
return
(
null_value
=
0
);
null_date:
null_date:
return
(
null_value
=
1
);
return
(
null_value
=
1
);
...
...
sql/mysql_priv.h
View file @
7ea9d1e6
...
@@ -2582,6 +2582,7 @@ check_date(const MYSQL_TIME *ltime, ulonglong flags, int *was_cut)
...
@@ -2582,6 +2582,7 @@ check_date(const MYSQL_TIME *ltime, ulonglong flags, int *was_cut)
}
}
bool
check_date_with_warn
(
const
MYSQL_TIME
*
ltime
,
uint
fuzzy_date
,
bool
check_date_with_warn
(
const
MYSQL_TIME
*
ltime
,
uint
fuzzy_date
,
timestamp_type
ts_type
);
timestamp_type
ts_type
);
bool
adjust_time_range_with_warn
(
MYSQL_TIME
*
ltime
,
uint
dec
);
int
test_if_number
(
char
*
str
,
int
*
res
,
bool
allow_wildcards
);
int
test_if_number
(
char
*
str
,
int
*
res
,
bool
allow_wildcards
);
void
change_byte
(
uchar
*
,
uint
,
char
,
char
);
void
change_byte
(
uchar
*
,
uint
,
char
,
char
);
bool
init_read_record
(
READ_RECORD
*
info
,
THD
*
thd
,
TABLE
*
reg_form
,
bool
init_read_record
(
READ_RECORD
*
info
,
THD
*
thd
,
TABLE
*
reg_form
,
...
...
sql/time.cc
View file @
7ea9d1e6
...
@@ -229,6 +229,20 @@ check_date_with_warn(const MYSQL_TIME *ltime, uint fuzzy_date,
...
@@ -229,6 +229,20 @@ check_date_with_warn(const MYSQL_TIME *ltime, uint fuzzy_date,
}
}
bool
adjust_time_range_with_warn
(
MYSQL_TIME
*
ltime
,
uint
dec
)
{
MYSQL_TIME
copy
=
*
ltime
;
Lazy_string_time
str
(
&
copy
);
int
warnings
=
0
;
if
(
check_time_range
(
ltime
,
dec
,
&
warnings
))
return
true
;
if
(
warnings
)
make_truncated_value_warning
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
&
str
,
MYSQL_TIMESTAMP_TIME
,
NullS
);
return
false
;
}
/*
/*
Convert a timestamp string to a MYSQL_TIME value and produce a warning
Convert a timestamp string to a MYSQL_TIME value and produce a warning
if string was truncated during conversion.
if string was truncated during conversion.
...
...
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