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
d37471b4
Commit
d37471b4
authored
Jun 24, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gleb.loc:/home/uchum/work/bk/5.0-opt-29095
into gleb.loc:/home/uchum/work/bk/5.0-opt
parents
f3940eba
1bab1ddc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
2 deletions
+57
-2
mysql-test/r/insert_select.result
mysql-test/r/insert_select.result
+31
-0
mysql-test/t/insert_select.test
mysql-test/t/insert_select.test
+25
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-2
No files found.
mysql-test/r/insert_select.result
View file @
d37471b4
...
...
@@ -688,7 +688,16 @@ ERROR 42S22: Unknown column 't2.x' in 'field list'
drop table t1,t2;
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2);
flush status;
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
show status like 'Handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 1
DROP TABLE t1;
CREATE TABLE t1 (x int, y int);
CREATE TABLE t2 (z int, y int);
...
...
@@ -773,3 +782,25 @@ d
20
20
DROP TABLE t1,t2;
CREATE TABLE t1 (
id INT AUTO_INCREMENT PRIMARY KEY,
prev_id INT,
join_id INT DEFAULT 0);
INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
SELECT * FROM t1;
id prev_id join_id
1 NULL 0
2 1 0
3 2 0
CREATE TABLE t2 (join_id INT);
INSERT INTO t2 (join_id) VALUES (0);
INSERT INTO t1 (prev_id) SELECT id
FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
ORDER BY id DESC LIMIT 1;
SELECT * FROM t1;
id prev_id join_id
1 NULL 0
2 1 0
3 2 0
4 3 0
DROP TABLE t1,t2;
mysql-test/t/insert_select.test
View file @
d37471b4
...
...
@@ -233,7 +233,9 @@ drop table t1,t2;
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
);
INSERT
INTO
t1
values
(
1
),
(
2
);
flush
status
;
INSERT
INTO
t1
SELECT
a
+
2
FROM
t1
LIMIT
1
;
show
status
like
'Handler_read%'
;
DROP
TABLE
t1
;
...
...
@@ -332,3 +334,26 @@ INSERT INTO t2 (d)
SELECT
*
FROM
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug #29095: incorrect pushing of LIMIT into the temporary
# table ignoring ORDER BY clause
#
CREATE
TABLE
t1
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
prev_id
INT
,
join_id
INT
DEFAULT
0
);
INSERT
INTO
t1
(
prev_id
)
VALUES
(
NULL
),
(
1
),
(
2
);
SELECT
*
FROM
t1
;
CREATE
TABLE
t2
(
join_id
INT
);
INSERT
INTO
t2
(
join_id
)
VALUES
(
0
);
INSERT
INTO
t1
(
prev_id
)
SELECT
id
FROM
t2
LEFT
JOIN
t1
ON
t1
.
join_id
=
t2
.
join_id
ORDER
BY
id
DESC
LIMIT
1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
,
t2
;
sql/sql_select.cc
View file @
d37471b4
...
...
@@ -1347,8 +1347,7 @@ JOIN::optimize()
there are aggregate functions, because in all these cases we need
all result rows.
*/
ha_rows
tmp_rows_limit
=
((
order
==
0
||
skip_sort_order
||
test
(
select_options
&
OPTION_BUFFER_RESULT
))
&&
ha_rows
tmp_rows_limit
=
((
order
==
0
||
skip_sort_order
)
&&
!
tmp_group
&&
!
thd
->
lex
->
current_select
->
with_sum_func
)
?
select_limit
:
HA_POS_ERROR
;
...
...
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