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
883ff0cc
Commit
883ff0cc
authored
Feb 28, 2005
by
ramil@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
merging
parents
b44f2400
725fd87d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
1 deletion
+30
-1
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+9
-0
mysql-test/r/show_check.result
mysql-test/r/show_check.result
+3
-1
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+9
-0
sql/sql_select.cc
sql/sql_select.cc
+9
-0
No files found.
mysql-test/r/func_group.result
View file @
883ff0cc
...
@@ -733,6 +733,15 @@ one 2
...
@@ -733,6 +733,15 @@ one 2
two 2
two 2
three 1
three 1
drop table t1;
drop table t1;
create table t1(a int, b datetime);
insert into t1 values (1, NOW()), (2, NOW());
create table t2 select MAX(b) from t1 group by a;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`MAX(b)` datetime default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1(f1 datetime);
create table t1(f1 datetime);
insert into t1 values (now());
insert into t1 values (now());
create table t2 select f2 from (select max(now()) f2 from t1) a;
create table t2 select f2 from (select max(now()) f2 from t1) a;
...
...
mysql-test/r/show_check.result
View file @
883ff0cc
...
@@ -250,9 +250,11 @@ type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_nume
...
@@ -250,9 +250,11 @@ type_bool type_tiny type_short type_mediumint type_bigint type_decimal type_nume
drop table t1;
drop table t1;
create table t1 (a int not null);
create table t1 (a int not null);
create table t2 select max(a) from t1;
create table t2 select max(a) from t1;
Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'max(a)' at row 1
show columns from t2;
show columns from t2;
Field Type Null Key Default Extra
Field Type Null Key Default Extra
max(a)
bigint(20) YES NULL
max(a)
int(11) 0
drop table t1,t2;
drop table t1,t2;
create table t1 (c decimal, d double, f float, r real);
create table t1 (c decimal, d double, f float, r real);
show columns from t1;
show columns from t1;
...
...
mysql-test/t/func_group.test
View file @
883ff0cc
...
@@ -474,6 +474,15 @@ INSERT INTO t1 VALUES
...
@@ -474,6 +474,15 @@ INSERT INTO t1 VALUES
select
val
,
count
(
*
)
from
t1
group
by
val
;
select
val
,
count
(
*
)
from
t1
group
by
val
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #5615: type of aggregate function column wrong when using group by
#
create
table
t1
(
a
int
,
b
datetime
);
insert
into
t1
values
(
1
,
NOW
()),
(
2
,
NOW
());
create
table
t2
select
MAX
(
b
)
from
t1
group
by
a
;
show
create
table
t2
;
drop
table
t1
,
t2
;
#
#
# Bug 7833: Wrong datatype of aggregate column is returned
# Bug 7833: Wrong datatype of aggregate column is returned
...
...
sql/sql_select.cc
View file @
883ff0cc
...
@@ -4771,6 +4771,15 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
...
@@ -4771,6 +4771,15 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
item
->
name
,
table
,
item_sum
->
decimals
);
item
->
name
,
table
,
item_sum
->
decimals
);
case
Item_sum
:
:
UNIQUE_USERS_FUNC
:
case
Item_sum
:
:
UNIQUE_USERS_FUNC
:
return
new
Field_long
(
9
,
maybe_null
,
item
->
name
,
table
,
1
);
return
new
Field_long
(
9
,
maybe_null
,
item
->
name
,
table
,
1
);
case
Item_sum
:
:
MIN_FUNC
:
case
Item_sum
:
:
MAX_FUNC
:
if
(
item_sum
->
args
[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
{
*
from_field
=
((
Item_field
*
)
item_sum
->
args
[
0
])
->
field
;
return
create_tmp_field_from_field
(
thd
,
*
from_field
,
item
,
table
,
modify_item
,
convert_blob_length
);
}
/* fall through */
default:
default:
switch
(
item_sum
->
result_type
())
{
switch
(
item_sum
->
result_type
())
{
case
REAL_RESULT
:
case
REAL_RESULT
:
...
...
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