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
340a29ec
Commit
340a29ec
authored
Mar 18, 2011
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lp:737450 Second Assertion `item->null_value' failed in 5.1-micro
implement Item_func_min_max::get_date()
parent
79f6e6f6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
9 deletions
+21
-9
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+6
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+8
-0
sql/item_func.cc
sql/item_func.cc
+6
-8
sql/item_func.h
sql/item_func.h
+1
-1
No files found.
mysql-test/r/func_time.result
View file @
340a29ec
...
...
@@ -1527,3 +1527,9 @@ NULL
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00'
drop table t1;
create table t1 (f2 time not null, f3 datetime, f4 int not null, f5 timestamp);
insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00');
select least(greatest(f3, f2, f4), f5) from t1;
least(greatest(f3, f2, f4), f5)
0000-00-00 00:00:00
drop table t1;
mysql-test/t/func_time.test
View file @
340a29ec
...
...
@@ -960,3 +960,11 @@ select timestampadd(week, 1, f1) from t1;
select
timestampadd
(
week
,
1
,
date
(
"0000-00-00"
));
drop
table
t1
;
#
# lp:737450 Second Assertion `item->null_value' failed in 5.1-micro
#
create
table
t1
(
f2
time
not
null
,
f3
datetime
,
f4
int
not
null
,
f5
timestamp
);
insert
ignore
t1
values
(
'04:38:11'
,
'0000-00-00 00:00:00'
,
0
,
'0000-00-00 00:00:00'
);
select
least
(
greatest
(
f3
,
f2
,
f4
),
f5
)
from
t1
;
drop
table
t1
;
sql/item_func.cc
View file @
340a29ec
...
...
@@ -2259,9 +2259,6 @@ void Item_func_min_max::fix_length_and_dec()
/*
Compare item arguments in the DATETIME context.
SYNOPSIS
cmp_datetimes()
DESCRIPTION
Compare item arguments as DATETIME values and return the index of the
least/greatest argument in the arguments array.
...
...
@@ -2273,9 +2270,10 @@ void Item_func_min_max::fix_length_and_dec()
0 Otherwise
*/
bool
Item_func_min_max
::
cmp_datetimes
(
MYSQL_TIME
*
ltim
e
)
bool
Item_func_min_max
::
get_date
(
MYSQL_TIME
*
ltime
,
uint
fuzzy_dat
e
)
{
longlong
UNINIT_VAR
(
min_max
);
DBUG_ASSERT
(
fixed
==
1
);
for
(
uint
i
=
0
;
i
<
arg_count
;
i
++
)
{
...
...
@@ -2309,7 +2307,7 @@ String *Item_func_min_max::val_str(String *str)
if
(
compare_as_dates
)
{
MYSQL_TIME
ltime
;
if
(
cmp_datetimes
(
&
ltime
))
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
))
return
0
;
char
buf
[
MAX_DATE_STRING_REP_LENGTH
];
...
...
@@ -2383,7 +2381,7 @@ double Item_func_min_max::val_real()
if
(
compare_as_dates
)
{
MYSQL_TIME
ltime
;
if
(
cmp_datetimes
(
&
ltime
))
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
))
return
0
;
return
TIME_to_double
(
&
ltime
);
...
...
@@ -2412,7 +2410,7 @@ longlong Item_func_min_max::val_int()
if
(
compare_as_dates
)
{
MYSQL_TIME
ltime
;
if
(
cmp_datetimes
(
&
ltime
))
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
))
return
0
;
return
TIME_to_ulonglong
(
&
ltime
);
...
...
@@ -2442,7 +2440,7 @@ my_decimal *Item_func_min_max::val_decimal(my_decimal *dec)
if
(
compare_as_dates
)
{
MYSQL_TIME
ltime
;
if
(
cmp_datetimes
(
&
ltime
))
if
(
get_date
(
&
ltime
,
TIME_FUZZY_DATE
))
return
0
;
return
date2my_decimal
(
&
ltime
,
dec
);
...
...
sql/item_func.h
View file @
340a29ec
...
...
@@ -769,9 +769,9 @@ class Item_func_min_max :public Item_func
longlong
val_int
();
String
*
val_str
(
String
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
bool
get_date
(
MYSQL_TIME
*
res
,
uint
fuzzy_date
);
void
fix_length_and_dec
();
enum
Item_result
result_type
()
const
{
return
cmp_type
;
}
bool
cmp_datetimes
(
MYSQL_TIME
*
ltime
);
enum_field_types
field_type
()
const
{
return
cached_field_type
;
}
};
...
...
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