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
0a7e4186
Commit
0a7e4186
authored
Sep 08, 2009
by
Alexey Kopytov
Browse files
Options
Browse Files
Download
Plain Diff
Automerge.
parents
fe3b6356
50534602
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
1 deletion
+74
-1
mysql-test/r/distinct.result
mysql-test/r/distinct.result
+30
-0
mysql-test/t/distinct.test
mysql-test/t/distinct.test
+40
-0
sql/sql_select.cc
sql/sql_select.cc
+4
-1
No files found.
mysql-test/r/distinct.result
View file @
0a7e4186
...
@@ -763,4 +763,34 @@ a b d c
...
@@ -763,4 +763,34 @@ a b d c
1 2 0 2
1 2 0 2
1 2 0 3
1 2 0 3
DROP TABLE t1;
DROP TABLE t1;
#
# Bug #46159: simple query that never returns
#
SET @old_max_heap_table_size = @@max_heap_table_size;
SET @@max_heap_table_size = 16384;
SET @old_sort_buffer_size = @@sort_buffer_size;
SET @@sort_buffer_size = 32804;
CREATE TABLE t1(c1 int, c2 VARCHAR(20));
INSERT INTO t1 VALUES (1, '1'), (1, '1'), (2, '2'), (3, '1'), (3, '1'), (4, '4');
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
INSERT INTO t1 SELECT 5 + 10000 * RAND(), '5' FROM t1;
SELECT c1, c2, COUNT(*) FROM t1 GROUP BY c1 LIMIT 4;
c1 c2 COUNT(*)
1 1 2
2 2 1
3 1 2
4 4 1
SELECT DISTINCT c2 FROM t1 GROUP BY c1 HAVING COUNT(*) > 1;
c2
1
5
DROP TABLE t1;
SET @@sort_buffer_size = @old_sort_buffer_size;
SET @@max_heap_table_size = @old_max_heap_table_size;
End of 5.1 tests
End of 5.1 tests
mysql-test/t/distinct.test
View file @
0a7e4186
...
@@ -573,4 +573,44 @@ SELECT DISTINCT a, b, d, c FROM t1;
...
@@ -573,4 +573,44 @@ SELECT DISTINCT a, b, d, c FROM t1;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug #46159: simple query that never returns
--
echo
#
# Set max_heap_table_size to the minimum value so that GROUP BY table in the
# SELECT query below gets converted to MyISAM
SET
@
old_max_heap_table_size
=
@@
max_heap_table_size
;
SET
@@
max_heap_table_size
=
16384
;
# Set sort_buffer_size to the mininum value so that remove_duplicates() calls
# remove_dup_with_compare()
SET
@
old_sort_buffer_size
=
@@
sort_buffer_size
;
SET
@@
sort_buffer_size
=
32804
;
CREATE
TABLE
t1
(
c1
int
,
c2
VARCHAR
(
20
));
INSERT
INTO
t1
VALUES
(
1
,
'1'
),
(
1
,
'1'
),
(
2
,
'2'
),
(
3
,
'1'
),
(
3
,
'1'
),
(
4
,
'4'
);
# Now we just need to pad the table with random data so we have enough unique
# values to force conversion of the GROUP BY table to MyISAM
INSERT
INTO
t1
SELECT
5
+
10000
*
RAND
(),
'5'
FROM
t1
;
INSERT
INTO
t1
SELECT
5
+
10000
*
RAND
(),
'5'
FROM
t1
;
INSERT
INTO
t1
SELECT
5
+
10000
*
RAND
(),
'5'
FROM
t1
;
INSERT
INTO
t1
SELECT
5
+
10000
*
RAND
(),
'5'
FROM
t1
;
INSERT
INTO
t1
SELECT
5
+
10000
*
RAND
(),
'5'
FROM
t1
;
INSERT
INTO
t1
SELECT
5
+
10000
*
RAND
(),
'5'
FROM
t1
;
INSERT
INTO
t1
SELECT
5
+
10000
*
RAND
(),
'5'
FROM
t1
;
INSERT
INTO
t1
SELECT
5
+
10000
*
RAND
(),
'5'
FROM
t1
;
# First rows of the GROUP BY table that will be processed by
# remove_dup_with_compare()
SELECT
c1
,
c2
,
COUNT
(
*
)
FROM
t1
GROUP
BY
c1
LIMIT
4
;
# The actual test case
SELECT
DISTINCT
c2
FROM
t1
GROUP
BY
c1
HAVING
COUNT
(
*
)
>
1
;
# Cleanup
DROP
TABLE
t1
;
SET
@@
sort_buffer_size
=
@
old_sort_buffer_size
;
SET
@@
max_heap_table_size
=
@
old_max_heap_table_size
;
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
sql/sql_select.cc
View file @
0a7e4186
...
@@ -13682,7 +13682,10 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
...
@@ -13682,7 +13682,10 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field,
if
(
error
)
if
(
error
)
{
{
if
(
error
==
HA_ERR_RECORD_DELETED
)
if
(
error
==
HA_ERR_RECORD_DELETED
)
{
error
=
file
->
rnd_next
(
record
);
continue
;
continue
;
}
if
(
error
==
HA_ERR_END_OF_FILE
)
if
(
error
==
HA_ERR_END_OF_FILE
)
break
;
break
;
goto
err
;
goto
err
;
...
...
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