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
dccac583
Commit
dccac583
authored
Mar 11, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed an obscure bug in group by + having + Item_ref::get_date
parent
312f0366
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
4 deletions
+27
-4
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+1
-0
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+8
-0
sql/item.cc
sql/item.cc
+11
-0
sql/item.h
sql/item.h
+7
-4
No files found.
mysql-test/r/group_by.result
View file @
dccac583
...
@@ -128,3 +128,4 @@ a MAX(b) ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f')
...
@@ -128,3 +128,4 @@ a MAX(b) ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f')
a MAX(b) MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
a MAX(b) MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
1 4 c
1 4 c
10 43 a,b,d,f
10 43 a,b,d,f
a c count(distinct rand())
mysql-test/t/group_by.test
View file @
dccac583
...
@@ -346,3 +346,11 @@ select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a;
...
@@ -346,3 +346,11 @@ select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a;
select
a
,
MAX
(
b
),
ELT
(
MAX
(
b
),
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
)
from
t1
group
by
a
;
select
a
,
MAX
(
b
),
ELT
(
MAX
(
b
),
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
)
from
t1
group
by
a
;
select
a
,
MAX
(
b
),
MAKE_SET
(
MAX
(
b
),
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
)
from
t1
group
by
a
;
select
a
,
MAX
(
b
),
MAKE_SET
(
MAX
(
b
),
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
)
from
t1
group
by
a
;
drop
table
t1
;
drop
table
t1
;
# not purely group_by bug, but group_by is involved...
create
table
t1
(
a
date
default
null
,
b
date
default
null
);
insert
t1
values
(
'1999-10-01'
,
'2000-01-10'
),
(
'1997-01-01'
,
'1998-10-01'
);
select
a
,
min
(
b
)
c
,
count
(
distinct
rand
())
from
t1
group
by
a
having
c
<
a
+
interval
1
day
;
drop
table
t1
;
sql/item.cc
View file @
dccac583
...
@@ -194,6 +194,17 @@ bool Item_field::get_date(TIME *ltime,bool fuzzydate)
...
@@ -194,6 +194,17 @@ bool Item_field::get_date(TIME *ltime,bool fuzzydate)
return
0
;
return
0
;
}
}
bool
Item_field
::
get_date_result
(
TIME
*
ltime
,
bool
fuzzydate
)
{
if
((
null_value
=
result_field
->
is_null
())
||
result_field
->
get_date
(
ltime
,
fuzzydate
))
{
bzero
((
char
*
)
ltime
,
sizeof
(
*
ltime
));
return
1
;
}
return
0
;
}
bool
Item_field
::
get_time
(
TIME
*
ltime
)
bool
Item_field
::
get_time
(
TIME
*
ltime
)
{
{
if
((
null_value
=
field
->
is_null
())
||
field
->
get_time
(
ltime
))
if
((
null_value
=
field
->
is_null
())
||
field
->
get_time
(
ltime
))
...
...
sql/item.h
View file @
dccac583
...
@@ -82,6 +82,8 @@ class Item {
...
@@ -82,6 +82,8 @@ class Item {
virtual
void
split_sum_func
(
List
<
Item
>
&
fields
)
{}
virtual
void
split_sum_func
(
List
<
Item
>
&
fields
)
{}
virtual
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
);
virtual
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
);
virtual
bool
get_time
(
TIME
*
ltime
);
virtual
bool
get_time
(
TIME
*
ltime
);
virtual
bool
get_date_result
(
TIME
*
ltime
,
bool
fuzzydate
)
{
return
get_date
(
ltime
,
fuzzydate
);
}
};
};
...
@@ -129,8 +131,9 @@ class Item_field :public Item_ident
...
@@ -129,8 +131,9 @@ class Item_field :public Item_ident
return
field
->
result_type
();
return
field
->
result_type
();
}
}
Field
*
tmp_table_field
()
{
return
result_field
;
}
Field
*
tmp_table_field
()
{
return
result_field
;
}
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
);
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
);
bool
get_time
(
TIME
*
ltime
);
bool
get_date_result
(
TIME
*
ltime
,
bool
fuzzydate
);
bool
get_time
(
TIME
*
ltime
);
};
};
...
@@ -332,8 +335,8 @@ class Item_ref :public Item_ident
...
@@ -332,8 +335,8 @@ class Item_ref :public Item_ident
return
tmp
;
return
tmp
;
}
}
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
)
bool
get_date
(
TIME
*
ltime
,
bool
fuzzydate
)
{
{
return
(
null_value
=
(
*
ref
)
->
get_date
(
ltime
,
fuzzydate
));
return
(
null_value
=
(
*
ref
)
->
get_date
_result
(
ltime
,
fuzzydate
));
}
}
bool
send
(
String
*
tmp
)
{
return
(
*
ref
)
->
send
(
tmp
);
}
bool
send
(
String
*
tmp
)
{
return
(
*
ref
)
->
send
(
tmp
);
}
void
make_field
(
Send_field
*
field
)
{
(
*
ref
)
->
make_field
(
field
);
}
void
make_field
(
Send_field
*
field
)
{
(
*
ref
)
->
make_field
(
field
);
}
...
...
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