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
aa482ce8
Commit
aa482ce8
authored
Apr 05, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0
parents
931b9694
28e1a841
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletion
+45
-1
mysql-test/r/view.result
mysql-test/r/view.result
+17
-0
mysql-test/t/view.test
mysql-test/t/view.test
+21
-0
sql/opt_sum.cc
sql/opt_sum.cc
+7
-1
No files found.
mysql-test/r/view.result
View file @
aa482ce8
...
@@ -2562,3 +2562,20 @@ my_sqrt
...
@@ -2562,3 +2562,20 @@ my_sqrt
1.4142135623731
1.4142135623731
DROP VIEW v1;
DROP VIEW v1;
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (id int PRIMARY KEY);
CREATE TABLE t2 (id int PRIMARY KEY);
INSERT INTO t1 VALUES (1), (3);
INSERT INTO t2 VALUES (1), (2), (3);
CREATE VIEW v2 AS SELECT * FROM t2;
SELECT COUNT(*) FROM t1 LEFT JOIN t2 ON t1.id=t2.id;
COUNT(*)
2
SELECT * FROM t1 LEFT JOIN t2 ON t1.id=t2.id;
id id
1 1
3 3
SELECT COUNT(*) FROM t1 LEFT JOIN v2 ON t1.id=v2.id;
COUNT(*)
2
DROP VIEW v2;
DROP TABLE t1, t2;
mysql-test/t/view.test
View file @
aa482ce8
...
@@ -2413,3 +2413,24 @@ SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
...
@@ -2413,3 +2413,24 @@ SELECT my_sqrt FROM v1 ORDER BY my_sqrt;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #18237: invalid count optimization applied to an outer join with a view
#
CREATE
TABLE
t1
(
id
int
PRIMARY
KEY
);
CREATE
TABLE
t2
(
id
int
PRIMARY
KEY
);
INSERT
INTO
t1
VALUES
(
1
),
(
3
);
INSERT
INTO
t2
VALUES
(
1
),
(
2
),
(
3
);
CREATE
VIEW
v2
AS
SELECT
*
FROM
t2
;
SELECT
COUNT
(
*
)
FROM
t1
LEFT
JOIN
t2
ON
t1
.
id
=
t2
.
id
;
SELECT
*
FROM
t1
LEFT
JOIN
t2
ON
t1
.
id
=
t2
.
id
;
SELECT
COUNT
(
*
)
FROM
t1
LEFT
JOIN
v2
ON
t1
.
id
=
v2
.
id
;
DROP
VIEW
v2
;
DROP
TABLE
t1
,
t2
;
sql/opt_sum.cc
View file @
aa482ce8
...
@@ -96,8 +96,14 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
...
@@ -96,8 +96,14 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
*/
*/
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_leaf
)
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_leaf
)
{
{
TABLE_LIST
*
embedded
;
for
(
embedded
=
tl
;
embedded
;
embedded
=
embedded
->
embedding
)
{
if
(
embedded
->
on_expr
)
break
;
}
if
(
embedded
)
/* Don't replace expression on a table that is part of an outer join */
/* Don't replace expression on a table that is part of an outer join */
if
(
tl
->
on_expr
)
{
{
outer_tables
|=
tl
->
table
->
map
;
outer_tables
|=
tl
->
table
->
map
;
...
...
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