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
7e66dbea
Commit
7e66dbea
authored
May 04, 2009
by
Martin Hansson
Browse files
Options
Browse Files
Download
Plain Diff
Bug#44306: Assertion fail on duplicate key error in
'INSERT ... SELECT' statements Merge
parents
a83b1bdb
fdd5a63f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
mysql-test/r/insert_select.result
mysql-test/r/insert_select.result
+5
-0
mysql-test/t/insert_select.test
mysql-test/t/insert_select.test
+10
-0
sql/sql_select.cc
sql/sql_select.cc
+4
-2
No files found.
mysql-test/r/insert_select.result
View file @
7e66dbea
...
@@ -765,6 +765,11 @@ f1 f2
...
@@ -765,6 +765,11 @@ f1 f2
2 2
2 2
10 10
10 10
DROP TABLE t1, t2;
DROP TABLE t1, t2;
CREATE TABLE t1 ( a INT KEY, b INT );
INSERT INTO t1 VALUES ( 0, 1 );
INSERT INTO t1 ( b ) SELECT MAX( b ) FROM t1 WHERE b = 2;
ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
DROP TABLE t1;
SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
SET SQL_MODE='STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10)));
CREATE TABLE t1 (c VARCHAR(30), INDEX ix_c (c(10)));
CREATE TABLE t2 (d VARCHAR(10));
CREATE TABLE t2 (d VARCHAR(10));
...
...
mysql-test/t/insert_select.test
View file @
7e66dbea
...
@@ -323,6 +323,16 @@ INSERT INTO t2 (f1, f2)
...
@@ -323,6 +323,16 @@ INSERT INTO t2 (f1, f2)
SELECT
*
FROM
t2
;
SELECT
*
FROM
t2
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug#44306: Assertion fail on duplicate key error in 'INSERT ... SELECT'
# statements
#
CREATE
TABLE
t1
(
a
INT
KEY
,
b
INT
);
INSERT
INTO
t1
VALUES
(
0
,
1
);
--
error
ER_DUP_ENTRY
INSERT
INTO
t1
(
b
)
SELECT
MAX
(
b
)
FROM
t1
WHERE
b
=
2
;
DROP
TABLE
t1
;
#
#
# Bug #26207: inserts don't work with shortened index
# Bug #26207: inserts don't work with shortened index
#
#
...
...
sql/sql_select.cc
View file @
7e66dbea
...
@@ -7092,14 +7092,16 @@ return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
...
@@ -7092,14 +7092,16 @@ return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
if
(
!
(
result
->
send_fields
(
fields
,
if
(
!
(
result
->
send_fields
(
fields
,
Protocol
::
SEND_NUM_ROWS
|
Protocol
::
SEND_EOF
)))
Protocol
::
SEND_NUM_ROWS
|
Protocol
::
SEND_EOF
)))
{
{
bool
send_error
=
FALSE
;
if
(
send_row
)
if
(
send_row
)
{
{
List_iterator_fast
<
Item
>
it
(
fields
);
List_iterator_fast
<
Item
>
it
(
fields
);
Item
*
item
;
Item
*
item
;
while
((
item
=
it
++
))
while
((
item
=
it
++
))
item
->
no_rows_in_result
();
item
->
no_rows_in_result
();
result
->
send_data
(
fields
);
send_error
=
result
->
send_data
(
fields
);
}
}
if
(
!
send_error
)
result
->
send_eof
();
// Should be safe
result
->
send_eof
();
// Should be safe
}
}
/* Update results for FOUND_ROWS */
/* Update results for FOUND_ROWS */
...
...
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