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
a4483aaa
Commit
a4483aaa
authored
Aug 06, 2003
by
kostja@oak.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge oak.local:/home/kostja/mysql/mysql-4.1-root
into oak.local:/home/kostja/mysql/mysql-4.1-count-distinct
parents
a60acfcf
2205e3c4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
1 deletion
+69
-1
mysql-test/r/count_distinct3.result
mysql-test/r/count_distinct3.result
+7
-0
mysql-test/t/count_distinct3.test
mysql-test/t/count_distinct3.test
+55
-0
sql/records.cc
sql/records.cc
+7
-1
No files found.
mysql-test/r/count_distinct3.result
0 → 100644
View file @
a4483aaa
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (id INTEGER, grp TINYINT, id_rev INTEGER);
SELECT COUNT(*) FROM t1;
COUNT(*)
4181000
SELECT COUNT(DISTINCT id) FROM t1 GROUP BY grp;
DROP TABLE t1;
mysql-test/t/count_distinct3.test
0 → 100644
View file @
a4483aaa
#
# this is a test for error 1032 in count(distinct) + group by, introduced in
# mysql-4.1
#
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
;
--
enable_warnings
CREATE
TABLE
t1
(
id
INTEGER
,
grp
TINYINT
,
id_rev
INTEGER
);
--
disable_query_log
SET
@
rnd_max
=
2147483647
;
let
$
1
=
1000
;
while
(
$
1
)
{
SET
@
rnd
=
RAND
();
SET
@
id
=
CAST
(
@
rnd
*
@
rnd_max
AS
UNSIGNED
);
SET
@
id_rev
=
@
rnd_max
-
@
id
;
SET
@
grp
=
CAST
(
128.0
*
@
rnd
AS
UNSIGNED
);
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
VALUES
(
@
id
,
@
grp
,
@
id_rev
);
dec
$
1
;
}
CREATE
TABLE
t2
SELECT
*
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t2
;
INSERT
INTO
t2
(
id
,
grp
,
id_rev
)
SELECT
id
,
grp
,
id_rev
FROM
t1
;
DROP
TABLE
t2
;
--
enable_query_log
SELECT
COUNT
(
*
)
FROM
t1
;
# As t1 contains random numbers, results are different from test to test.
# That's okay, because we test only that select doesn't yield an
# error. Note, that --disable_result_log doesn't suppress error output.
--
disable_result_log
SELECT
COUNT
(
DISTINCT
id
)
FROM
t1
GROUP
BY
grp
;
--
enable_result_log
DROP
TABLE
t1
;
sql/records.cc
View file @
a4483aaa
...
@@ -73,7 +73,13 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
...
@@ -73,7 +73,13 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
info
->
ref_pos
=
table
->
file
->
ref
;
info
->
ref_pos
=
table
->
file
->
ref
;
table
->
file
->
rnd_init
(
0
);
table
->
file
->
rnd_init
(
0
);
if
(
!
(
specialflag
&
SPECIAL_SAFE_MODE
)
&&
/*
table->sort.addon_field is checked because if we use addon fields,
it doesn't make sense to use cache - we don't read from the table
and table->sort.io_cache is read sequentially
*/
if
(
!
table
->
sort
.
addon_field
&&
!
(
specialflag
&
SPECIAL_SAFE_MODE
)
&&
thd
->
variables
.
read_rnd_buff_size
&&
thd
->
variables
.
read_rnd_buff_size
&&
!
table
->
file
->
fast_key_read
()
&&
!
table
->
file
->
fast_key_read
()
&&
(
table
->
db_stat
&
HA_READ_ONLY
||
(
table
->
db_stat
&
HA_READ_ONLY
||
...
...
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