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
445bc133
Commit
445bc133
authored
Aug 10, 2005
by
acurtis@xiphis.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge xiphis.org:/usr/home/antony/work2/p2-bug10109.3
into xiphis.org:/usr/home/antony/work2/p2-bug10109.4
parents
9125477d
015447b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
6 deletions
+45
-6
mysql-test/r/insert_update.result
mysql-test/r/insert_update.result
+6
-0
mysql-test/t/insert_update.test
mysql-test/t/insert_update.test
+14
-0
sql/sql_insert.cc
sql/sql_insert.cc
+25
-6
No files found.
mysql-test/r/insert_update.result
View file @
445bc133
...
@@ -191,3 +191,9 @@ ERROR 23000: Column 'a' in field list is ambiguous
...
@@ -191,3 +191,9 @@ ERROR 23000: Column 'a' in field list is ambiguous
insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ;
insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ;
ERROR 23000: Column 't1.a' in field list is ambiguous
ERROR 23000: Column 't1.a' in field list is ambiguous
drop table t1;
drop table t1;
CREATE TABLE t1 (
a BIGINT(20) NOT NULL DEFAULT 0,
PRIMARY KEY (a)
) ENGINE=MyISAM;
INSERT INTO t1 ( a ) SELECT 0 ON DUPLICATE KEY UPDATE a = a + VALUES (a) ;
DROP TABLE t1;
mysql-test/t/insert_update.test
View file @
445bc133
...
@@ -101,4 +101,18 @@ insert into t1 select a from t1 on duplicate key update a=a+1 ;
...
@@ -101,4 +101,18 @@ insert into t1 select a from t1 on duplicate key update a=a+1 ;
insert
ignore
into
t1
select
a
from
t1
on
duplicate
key
update
a
=
t1
.
a
+
1
;
insert
ignore
into
t1
select
a
from
t1
on
duplicate
key
update
a
=
t1
.
a
+
1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug#10109 - INSERT .. SELECT ... ON DUPLICATE KEY UPDATE fails
# Bogus "Duplicate columns" error message
#
CREATE
TABLE
t1
(
a
BIGINT
(
20
)
NOT
NULL
DEFAULT
0
,
PRIMARY
KEY
(
a
)
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
(
a
)
SELECT
0
ON
DUPLICATE
KEY
UPDATE
a
=
a
+
VALUES
(
a
)
;
DROP
TABLE
t1
;
# End of 4.1 tests
# End of 4.1 tests
sql/sql_insert.cc
View file @
445bc133
...
@@ -808,11 +808,11 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
...
@@ -808,11 +808,11 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
table_list
->
next_local
=
0
;
table_list
->
next_local
=
0
;
select_lex
->
context
.
resolve_in_table_list_only
(
table_list
);
select_lex
->
context
.
resolve_in_table_list_only
(
table_list
);
if
(
(
values
&&
check_insert_fields
(
thd
,
table_list
,
fields
,
*
values
,
if
(
values
&&
!
insert_into_view
))
||
!
(
res
=
check_insert_fields
(
thd
,
table_list
,
fields
,
*
values
,
(
values
&&
setup_fields
(
thd
,
0
,
*
values
,
0
,
0
,
0
)))
!
insert_into_view
)
||
res
=
TRUE
;
setup_fields
(
thd
,
0
,
*
values
,
0
,
0
,
0
))
&&
else
if
(
duplic
==
DUP_UPDATE
)
duplic
==
DUP_UPDATE
)
{
{
select_lex
->
no_wrap_view_item
=
TRUE
;
select_lex
->
no_wrap_view_item
=
TRUE
;
res
=
check_update_fields
(
thd
,
table_list
,
update_fields
);
res
=
check_update_fields
(
thd
,
table_list
,
update_fields
);
...
@@ -2089,7 +2089,26 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
...
@@ -2089,7 +2089,26 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
*/
*/
lex
->
current_select
=
&
lex
->
select_lex
;
lex
->
current_select
=
&
lex
->
select_lex
;
res
=
check_insert_fields
(
thd
,
table_list
,
*
fields
,
values
,
res
=
check_insert_fields
(
thd
,
table_list
,
*
fields
,
values
,
!
insert_into_view
);
!
insert_into_view
)
||
setup_fields
(
thd
,
0
,
values
,
0
,
0
,
0
);
if
(
info
.
handle_duplicates
==
DUP_UPDATE
)
{
TABLE_LIST
*
save_next_local
=
table_list
->
next_local
;
table_list
->
next_local
=
0
;
lex
->
select_lex
.
context
.
resolve_in_table_list_only
(
table_list
);
lex
->
select_lex
.
no_wrap_view_item
=
TRUE
;
res
=
res
||
check_update_fields
(
thd
,
table_list
,
*
info
.
update_fields
);
lex
->
select_lex
.
no_wrap_view_item
=
FALSE
;
/*
When we are not using GROUP BY we can refer to other tables in the
ON DUPLICATE KEY part
*/
if
(
!
lex
->
select_lex
.
group_list
.
elements
)
table_list
->
next_local
=
save_next_local
;
res
=
res
||
setup_fields
(
thd
,
0
,
*
info
.
update_values
,
1
,
0
,
0
);
table_list
->
next_local
=
save_next_local
;
}
lex
->
current_select
=
lex_current_select_save
;
lex
->
current_select
=
lex_current_select_save
;
if
(
res
)
if
(
res
)
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
...
...
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