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
66c86d95
Commit
66c86d95
authored
Jan 24, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/mydev/mysql-4.0
into mysql.com:/home/mydev/mysql-4.0-4000 sql/sql_select.cc: Auto merged
parents
e0e89c65
2afeecfc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
3 deletions
+27
-3
mysql-test/r/select_found.result
mysql-test/r/select_found.result
+8
-0
mysql-test/t/select_found.test
mysql-test/t/select_found.test
+9
-0
sql/sql_select.cc
sql/sql_select.cc
+10
-3
No files found.
mysql-test/r/select_found.result
View file @
66c86d95
...
...
@@ -223,3 +223,11 @@ SELECT FOUND_ROWS();
FOUND_ROWS()
0
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,2), (1,3), (1,4), (1,5);
SELECT SQL_CALC_FOUND_ROWS DISTINCT 'a' FROM t1 GROUP BY b LIMIT 2;
a
a
SELECT FOUND_ROWS();
FOUND_ROWS()
1
mysql-test/t/select_found.test
View file @
66c86d95
...
...
@@ -146,3 +146,12 @@ INSERT INTO t1 VALUES (0), (0), (1), (2);
SELECT
SQL_CALC_FOUND_ROWS
*
FROM
t1
WHERE
a
=
0
GROUP
BY
a
HAVING
a
>
10
;
SELECT
FOUND_ROWS
();
DROP
TABLE
t1
;
#
# Bug #7945: group by + distinct with constant expression + limit
#
CREATE
TABLE
t1
(
a
int
,
b
int
);
INSERT
INTO
t1
VALUES
(
1
,
2
),
(
1
,
3
),
(
1
,
4
),
(
1
,
5
);
SELECT
SQL_CALC_FOUND_ROWS
DISTINCT
'a'
FROM
t1
GROUP
BY
b
LIMIT
2
;
SELECT
FOUND_ROWS
();
sql/sql_select.cc
View file @
66c86d95
...
...
@@ -2138,9 +2138,15 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
x = used key parts (1 <= x <= c)
*/
double
rec_per_key
;
#if 0
if (!(rec_per_key=(double)
keyinfo->rec_per_key[keyinfo->key_parts-1]))
rec_per_key=(double) s->records/rec+1;
#else
rec_per_key
=
keyinfo
->
rec_per_key
[
keyinfo
->
key_parts
-
1
]
?
(
double
)
keyinfo
->
rec_per_key
[
keyinfo
->
key_parts
-
1
]
:
(
double
)
s
->
records
/
rec
+
1
;
#endif
if
(
!
s
->
records
)
tmp
=
0
;
...
...
@@ -6300,13 +6306,14 @@ remove_duplicates(JOIN *join, TABLE *entry,List<Item> &fields, Item *having)
field_count
++
;
}
if
(
!
field_count
)
{
// only const items
if
(
!
field_count
&&
!
(
join
->
select_options
&
OPTION_FOUND_ROWS
))
{
// only const items with no OPTION_FOUND_ROWS
join
->
thd
->
select_limit
=
1
;
// Only send first row
DBUG_RETURN
(
0
);
}
Field
**
first_field
=
entry
->
field
+
entry
->
fields
-
field_count
;
offset
=
entry
->
field
[
entry
->
fields
-
field_count
]
->
offset
();
offset
=
field_count
?
entry
->
field
[
entry
->
fields
-
field_count
]
->
offset
()
:
0
;
reclength
=
entry
->
reclength
-
offset
;
free_io_cache
(
entry
);
// Safety
...
...
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