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
f3877b65
Commit
f3877b65
authored
Feb 08, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed cleupup() for distinct aggregate functions (BUG#2663)
parent
69e2460b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
3 deletions
+48
-3
sql/item_sum.cc
sql/item_sum.cc
+15
-3
tests/client_test.c
tests/client_test.c
+33
-0
No files found.
sql/item_sum.cc
View file @
f3877b65
...
...
@@ -1093,12 +1093,17 @@ void Item_sum_count_distinct::cleanup()
if
(
!
original
)
{
if
(
table
)
{
free_tmp_table
(
current_thd
,
table
);
table
=
0
;
}
delete
tmp_table_param
;
tmp_table_param
=
0
;
if
(
use_tree
)
{
delete_tree
(
tree
);
tabl
e
=
0
;
use_tree
=
0
;
use_tre
e
=
0
;
}
}
DBUG_VOID_RETURN
;
}
...
...
@@ -1677,10 +1682,17 @@ void Item_func_group_concat::cleanup()
{
THD
*
thd
=
current_thd
;
if
(
table
)
{
free_tmp_table
(
thd
,
table
);
table
=
0
;
}
delete
tmp_table_param
;
tmp_table_param
=
0
;
if
(
tree_mode
)
delete_tree
(
tree
);
{
delete_tree
(
tree
);
tree_mode
=
0
;
}
}
DBUG_VOID_RETURN
;
}
...
...
tests/client_test.c
View file @
f3877b65
...
...
@@ -8117,6 +8117,7 @@ static void test_subqueries()
myquery
(
rc
);
stmt
=
mysql_prepare
(
mysql
,
query
,
strlen
(
query
));
mystmt_init
(
stmt
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
rc
=
mysql_execute
(
stmt
);
...
...
@@ -8142,6 +8143,37 @@ static void test_bad_union()
myerror
(
NULL
);
}
static
void
test_distinct
()
{
MYSQL_STMT
*
stmt
;
int
rc
,
i
;
const
char
*
query
=
"SELECT count(distinct b), group_concat(a) FROM t1"
;
myheader
(
"test_subquery"
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS t1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE t1 (a int , b int);"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"insert into t1 values (1,1), (2, 2), (3,3), (4,4), (5,5);"
);
myquery
(
rc
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
stmt
=
mysql_prepare
(
mysql
,
query
,
strlen
(
query
));
mystmt_init
(
stmt
);
rc
=
mysql_execute
(
stmt
);
mystmt
(
stmt
,
rc
);
assert
(
1
==
my_process_stmt_result
(
stmt
));
mysql_stmt_close
(
stmt
);
}
rc
=
mysql_query
(
mysql
,
"DROP TABLE t1"
);
myquery
(
rc
);
}
/*
Read and parse arguments and MySQL options from my.cnf
...
...
@@ -8390,6 +8422,7 @@ int main(int argc, char **argv)
prepared queries */
test_subqueries
();
/* repeatable subqueries */
test_bad_union
();
/* correct setup of UNION */
test_distinct
();
/* distinct aggregate functions */
end_time
=
time
((
time_t
*
)
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