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
f5d36349
Commit
f5d36349
authored
Jan 20, 2005
by
ingo@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/mydev/mysql-4.1
into mysql.com:/home/mydev/mysql-4.1-4100
parents
7885d70b
4bff1b05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
mysql-test/r/insert_select.result
mysql-test/r/insert_select.result
+12
-0
mysql-test/t/insert_select.test
mysql-test/t/insert_select.test
+15
-0
sql/sql_select.cc
sql/sql_select.cc
+17
-1
No files found.
mysql-test/r/insert_select.result
View file @
f5d36349
...
...
@@ -638,3 +638,15 @@ No Field Count
0 1 100
0 2 100
drop table t1, t2;
CREATE TABLE t1 (
ID int(11) NOT NULL auto_increment,
NO int(11) NOT NULL default '0',
SEQ int(11) NOT NULL default '0',
PRIMARY KEY (ID),
KEY t1$NO (SEQ,NO)
) ENGINE=MyISAM;
INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
ID NO SEQ
1 1 1
drop table t1;
mysql-test/t/insert_select.test
View file @
f5d36349
...
...
@@ -182,3 +182,18 @@ insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2
select
*
from
t2
;
drop
table
t1
,
t2
;
#
# BUG#6034 - Error code 124: Wrong medium type
#
CREATE
TABLE
t1
(
ID
int
(
11
)
NOT
NULL
auto_increment
,
NO
int
(
11
)
NOT
NULL
default
'0'
,
SEQ
int
(
11
)
NOT
NULL
default
'0'
,
PRIMARY
KEY
(
ID
),
KEY
t1
$NO
(
SEQ
,
NO
)
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
(
SEQ
,
NO
)
SELECT
"1"
AS
SEQ
,
IF
(
MAX
(
NO
)
IS
NULL
,
0
,
MAX
(
NO
))
+
1
AS
NO
FROM
t1
WHERE
(
SEQ
=
1
);
select
SQL_BUFFER_RESULT
*
from
t1
WHERE
(
SEQ
=
1
);
drop
table
t1
;
sql/sql_select.cc
View file @
f5d36349
...
...
@@ -398,7 +398,16 @@ JOIN::prepare(Item ***rref_pointer_array,
goto
err
;
}
#endif
if
(
!
procedure
&&
result
&&
result
->
prepare
(
fields_list
,
unit_arg
))
/*
We must not yet prepare the result table if it is the same as one of the
source tables (INSERT SELECT). This is checked in mysql_execute_command()
and OPTION_BUFFER_RESULT is added to the select_options. A temporary
table is then used to hold the result. The preparation may disable
indexes on the result table, which may be used during the select, if it
is the same table (Bug #6034). Do the preparation after the select phase.
*/
if
(
!
procedure
&&
!
test
(
select_options
&
OPTION_BUFFER_RESULT
)
&&
result
&&
result
->
prepare
(
fields_list
,
unit_arg
))
goto
err
;
/* purecov: inspected */
if
(
select_lex
->
olap
==
ROLLUP_TYPE
&&
rollup_init
())
...
...
@@ -1043,6 +1052,13 @@ JOIN::exec()
DBUG_VOID_RETURN
;
}
}
else
if
(
test
(
select_options
&
OPTION_BUFFER_RESULT
)
&&
result
&&
result
->
prepare
(
fields_list
,
unit
))
{
error
=
1
;
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
DBUG_VOID_RETURN
;
}
if
(
!
tables_list
)
{
// Only test of functions
...
...
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