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
757a5fae
Commit
757a5fae
authored
Dec 02, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for sum_func IN (..)
parent
d46dbf53
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
2 deletions
+14
-2
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+5
-0
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+2
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+5
-1
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+2
-1
No files found.
mysql-test/r/group_by.result
View file @
757a5fae
...
...
@@ -47,6 +47,11 @@ userid count(*)
3 3
2 1
1 2
userid count(*)
3 3
1 2
userid count(*)
3 3
table type possible_keys key key_len ref rows Extra
t1 range spID spID 5 NULL 2 where used; Using index; Using temporary
table type possible_keys key key_len ref rows Extra
...
...
mysql-test/t/group_by.test
View file @
757a5fae
...
...
@@ -235,6 +235,8 @@ CREATE TABLE t1 (
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
2
),(
2
,
1
,
1
),(
3
,
3
,
3
),(
4
,
3
,
3
),(
5
,
3
,
3
);
explain
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
;
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
;
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
having
(
count
(
*
)
+
1
)
IN
(
4
,
3
);
select
userid
,
count
(
*
)
from
t1
group
by
userid
desc
having
3
IN
(
1
,
COUNT
(
*
));
explain
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
desc
;
explain
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
;
select
spid
,
count
(
*
)
from
t1
where
spid
between
1
and
2
group
by
spid
;
...
...
sql/item_cmpfunc.cc
View file @
757a5fae
...
...
@@ -1029,13 +1029,17 @@ void Item_func_in::update_used_tables()
used_tables_cache
|=
item
->
used_tables
();
const_item_cache
&=
item
->
const_item
();
}
void
Item_func_in
::
split_sum_func
(
List
<
Item
>
&
fields
)
{
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
if
(
item
->
with_sum_func
&&
item
->
type
()
!=
SUM_FUNC_ITEM
)
item
->
split_sum_func
(
fields
);
else
if
(
item
->
used_tables
()
||
item
->
type
()
==
SUM_FUNC_ITEM
)
{
fields
.
push_front
(
item
);
item
=
new
Item_ref
((
Item
**
)
fields
.
head_ref
(),
0
,
item
->
name
);
}
Item_func
::
split_sum_func
(
fields
);
}
...
...
sql/item_cmpfunc.h
View file @
757a5fae
...
...
@@ -410,8 +410,9 @@ class Item_func_in :public Item_int_func
longlong
val_int
();
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
)
{
bool
res
=
(
item
->
fix_fields
(
thd
,
tlist
)
||
Item_func
::
fix_fields
(
thd
,
tlist
));
with_sum_func
=
with_sum_func
||
item
->
with_sum_func
;
return
(
item
->
fix_fields
(
thd
,
tlist
)
||
Item_func
::
fix_fields
(
thd
,
tlist
));
return
res
;
}
void
fix_length_and_dec
();
~
Item_func_in
()
{
delete
item
;
delete
array
;
delete
in_item
;
}
...
...
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