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
9a62a078
Commit
9a62a078
authored
Oct 09, 2007
by
ramil/ram@ramil.myoffice.izhnet.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/ram/work/mysql-5.1-maint
into mysql.com:/home/ram/work/b31438/b31438.5.1
parents
b1ffa160
1e4ff5c0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
5 deletions
+52
-5
mysql-test/r/type_datetime.result
mysql-test/r/type_datetime.result
+14
-0
mysql-test/t/type_datetime.test
mysql-test/t/type_datetime.test
+13
-0
sql/item_timefunc.h
sql/item_timefunc.h
+3
-1
sql/sql_select.cc
sql/sql_select.cc
+22
-4
No files found.
mysql-test/r/type_datetime.result
View file @
9a62a078
...
...
@@ -436,6 +436,20 @@ f1
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 45:44:44'
drop table t1;
create table t1 (a tinyint);
insert into t1 values (), (), ();
select sum(a) from t1 group by convert(a, datetime);
sum(a)
NULL
select convert(a, datetime) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def convert(a, datetime) 12 29 0 Y 128 6 63
convert(a, datetime)
NULL
NULL
NULL
drop table t1;
End of 5.0 tests
set @org_mode=@@sql_mode;
create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03');
Warnings:
...
...
mysql-test/t/type_datetime.test
View file @
9a62a078
...
...
@@ -293,6 +293,19 @@ insert into t1 set f1 = '15:44:44';
select
*
from
t1
where
(
convert
(
f1
,
datetime
))
!=
1
;
drop
table
t1
;
#
# Bug #31249: problem with convert(..., datetime)
#
create
table
t1
(
a
tinyint
);
insert
into
t1
values
(),
(),
();
select
sum
(
a
)
from
t1
group
by
convert
(
a
,
datetime
);
--
enable_metadata
select
convert
(
a
,
datetime
)
from
t1
;
--
disable_metadata
drop
table
t1
;
--
echo
End
of
5.0
tests
#
# Test of storing datetime into date fields
#
...
...
sql/item_timefunc.h
View file @
9a62a078
...
...
@@ -847,7 +847,9 @@ public:
}
void
fix_length_and_dec
()
{
Item_typecast_maybe_null
::
fix_length_and_dec
();
collation
.
set
(
&
my_charset_bin
);
maybe_null
=
1
;
max_length
=
MAX_DATETIME_FULL_WIDTH
*
MY_CHARSET_BIN_MB_MAXLEN
;
decimals
=
DATETIME_DEC
;
}
bool
result_as_longlong
()
{
return
TRUE
;
}
...
...
sql/sql_select.cc
View file @
9a62a078
...
...
@@ -14370,13 +14370,31 @@ calc_group_buffer(JOIN *join,ORDER *group)
group_item
->
decimals
);
break
;
case
STRING_RESULT
:
{
enum
enum_field_types
type
=
group_item
->
field_type
();
/*
Group strings are taken as varstrings and require an length field.
A field is not yet created by create_tmp_field()
and the sizes should match up
.
As items represented as DATE/TIME fields in the group buffer
have STRING_RESULT result type, we increase the length
by 8 as maximum pack length of such fields
.
*/
key_length
+=
group_item
->
max_length
+
HA_KEY_BLOB_LENGTH
;
if
(
type
==
MYSQL_TYPE_TIME
||
type
==
MYSQL_TYPE_DATE
||
type
==
MYSQL_TYPE_DATETIME
||
type
==
MYSQL_TYPE_TIMESTAMP
)
{
key_length
+=
8
;
}
else
{
/*
Group strings are taken as varstrings and require an length field.
A field is not yet created by create_tmp_field()
and the sizes should match up.
*/
key_length
+=
group_item
->
max_length
+
HA_KEY_BLOB_LENGTH
;
}
break
;
}
default:
/* This case should never be choosen */
DBUG_ASSERT
(
0
);
...
...
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