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
5ac57749
Commit
5ac57749
authored
Dec 24, 2008
by
Sergey Glukhov
Browse files
Options
Browse Files
Download
Plain Diff
5.0-bugteam->5.1-bugteam merge
parents
d23d1b4b
a31795b8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
2 deletions
+75
-2
mysql-test/r/select.result
mysql-test/r/select.result
+33
-0
mysql-test/t/select.test
mysql-test/t/select.test
+36
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-1
sql/sql_select.h
sql/sql_select.h
+5
-1
No files found.
mysql-test/r/select.result
View file @
5ac57749
...
...
@@ -4340,6 +4340,39 @@ Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 6
DROP TABLE t1, t2;
CREATE TABLE t1 (f1 bigint(20) NOT NULL default '0',
f2 int(11) NOT NULL default '0',
f3 bigint(20) NOT NULL default '0',
f4 varchar(255) NOT NULL default '',
PRIMARY KEY (f1),
KEY key1 (f4),
KEY key2 (f2));
CREATE TABLE t2 (f1 int(11) NOT NULL default '0',
f2 enum('A1','A2','A3') NOT NULL default 'A1',
f3 int(11) NOT NULL default '0',
PRIMARY KEY (f1),
KEY key1 (f3));
CREATE TABLE t3 (f1 bigint(20) NOT NULL default '0',
f2 datetime NOT NULL default '1980-01-01 00:00:00',
PRIMARY KEY (f1));
insert into t1 values (1, 1, 1, 'abc');
insert into t1 values (2, 1, 2, 'def');
insert into t1 values (3, 1, 2, 'def');
insert into t2 values (1, 'A1', 1);
insert into t3 values (1, '1980-01-01');
SELECT a.f3, cr.f4, count(*) count
FROM t2 a
STRAIGHT_JOIN t1 cr ON cr.f2 = a.f1
LEFT JOIN
(t1 cr2
JOIN t3 ae2 ON cr2.f3 = ae2.f1
) ON a.f1 = cr2.f2 AND ae2.f2 < now() - INTERVAL 7 DAY AND
cr.f4 = cr2.f4
GROUP BY a.f3, cr.f4;
f3 f4 count
1 abc 1
1 def 2
drop table t1, t2, t3;
End of 5.0 tests
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
...
...
mysql-test/t/select.test
View file @
5ac57749
...
...
@@ -3690,6 +3690,42 @@ SELECT DISTINCT b FROM t1 LEFT JOIN t2 USING(a) WHERE c <= 3;
SHOW
STATUS
LIKE
'Handler_read%'
;
DROP
TABLE
t1
,
t2
;
#
# Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error
#
CREATE
TABLE
t1
(
f1
bigint
(
20
)
NOT
NULL
default
'0'
,
f2
int
(
11
)
NOT
NULL
default
'0'
,
f3
bigint
(
20
)
NOT
NULL
default
'0'
,
f4
varchar
(
255
)
NOT
NULL
default
''
,
PRIMARY
KEY
(
f1
),
KEY
key1
(
f4
),
KEY
key2
(
f2
));
CREATE
TABLE
t2
(
f1
int
(
11
)
NOT
NULL
default
'0'
,
f2
enum
(
'A1'
,
'A2'
,
'A3'
)
NOT
NULL
default
'A1'
,
f3
int
(
11
)
NOT
NULL
default
'0'
,
PRIMARY
KEY
(
f1
),
KEY
key1
(
f3
));
CREATE
TABLE
t3
(
f1
bigint
(
20
)
NOT
NULL
default
'0'
,
f2
datetime
NOT
NULL
default
'1980-01-01 00:00:00'
,
PRIMARY
KEY
(
f1
));
insert
into
t1
values
(
1
,
1
,
1
,
'abc'
);
insert
into
t1
values
(
2
,
1
,
2
,
'def'
);
insert
into
t1
values
(
3
,
1
,
2
,
'def'
);
insert
into
t2
values
(
1
,
'A1'
,
1
);
insert
into
t3
values
(
1
,
'1980-01-01'
);
SELECT
a
.
f3
,
cr
.
f4
,
count
(
*
)
count
FROM
t2
a
STRAIGHT_JOIN
t1
cr
ON
cr
.
f2
=
a
.
f1
LEFT
JOIN
(
t1
cr2
JOIN
t3
ae2
ON
cr2
.
f3
=
ae2
.
f1
)
ON
a
.
f1
=
cr2
.
f2
AND
ae2
.
f2
<
now
()
-
INTERVAL
7
DAY
AND
cr
.
f4
=
cr2
.
f4
GROUP
BY
a
.
f3
,
cr
.
f4
;
drop
table
t1
,
t2
,
t3
;
--
echo
End
of
5.0
tests
#
...
...
sql/sql_select.cc
View file @
5ac57749
...
...
@@ -2587,7 +2587,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables, COND *conds,
if
(
s
->
dependent
&
table
->
map
)
s
->
dependent
|=
table
->
reginfo
.
join_tab
->
dependent
;
}
if
(
s
->
dependent
)
if
(
outer_join
&
s
->
table
->
map
)
s
->
table
->
maybe_null
=
1
;
}
/* Catch illegal cross references for outer joins */
...
...
sql/sql_select.h
View file @
5ac57749
...
...
@@ -285,7 +285,11 @@ public:
fetching data from a cursor
*/
bool
resume_nested_loop
;
table_map
const_table_map
,
found_const_table_map
,
outer_join
;
table_map
const_table_map
,
found_const_table_map
;
/*
Bitmap of all inner tables from outer joins
*/
table_map
outer_join
;
ha_rows
send_records
,
found_records
,
examined_rows
,
row_limit
,
select_limit
;
/**
Used to fetch no more than given amount of rows per one
...
...
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