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
36c146c7
Commit
36c146c7
authored
Feb 17, 2005
by
acurtis@pcgem.rdg.cyberkinetica.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into pcgem.rdg.cyberkinetica.com:/var/db/bk/work-acurtis/bug8147.3
parents
bbafcd49
4b4a5659
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
mysql-test/r/insert_update.result
mysql-test/r/insert_update.result
+3
-3
mysql-test/t/insert_update.test
mysql-test/t/insert_update.test
+4
-3
sql/sql_insert.cc
sql/sql_insert.cc
+4
-0
No files found.
mysql-test/r/insert_update.result
View file @
36c146c7
...
@@ -140,10 +140,10 @@ a b c
...
@@ -140,10 +140,10 @@ a b c
5 6 130
5 6 130
TRUNCATE TABLE t1;
TRUNCATE TABLE t1;
INSERT t1 VALUES (1,2,10), (3,4,20);
INSERT t1 VALUES (1,2,10), (3,4,20);
CREATE TABLE t2 (
x INT, y INT, z
INT, d INT);
CREATE TABLE t2 (
a INT, b INT, c
INT, d INT);
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
INSERT t1 SELECT
x,y,z
FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
INSERT t1 SELECT
a,b,c
FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
SELECT * FROM t1;
SELECT * FROM t1;
a b c
a b c
1 2 10
1 2 10
...
@@ -157,7 +157,7 @@ a b c
...
@@ -157,7 +157,7 @@ a b c
3 4 120
3 4 120
5 0 30
5 0 30
8 9 60
8 9 60
INSERT t1 SELECT
x,y,z
FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
INSERT t1 SELECT
a,b,c
FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
SELECT *, VALUES(a) FROM t1;
SELECT *, VALUES(a) FROM t1;
a b c VALUES(a)
a b c VALUES(a)
1 2 10 NULL
1 2 10 NULL
...
...
mysql-test/t/insert_update.test
View file @
36c146c7
...
@@ -68,14 +68,15 @@ INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
...
@@ -68,14 +68,15 @@ INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
TRUNCATE
TABLE
t1
;
TRUNCATE
TABLE
t1
;
INSERT
t1
VALUES
(
1
,
2
,
10
),
(
3
,
4
,
20
);
INSERT
t1
VALUES
(
1
,
2
,
10
),
(
3
,
4
,
20
);
CREATE
TABLE
t2
(
x
INT
,
y
INT
,
z
INT
,
d
INT
);
CREATE
TABLE
t2
(
a
INT
,
b
INT
,
c
INT
,
d
INT
);
# column names deliberately clash with columns in t1 (Bug#8147)
INSERT
t2
VALUES
(
5
,
6
,
30
,
1
),
(
7
,
4
,
40
,
1
),
(
8
,
9
,
60
,
1
);
INSERT
t2
VALUES
(
5
,
6
,
30
,
1
),
(
7
,
4
,
40
,
1
),
(
8
,
9
,
60
,
1
);
INSERT
t2
VALUES
(
2
,
1
,
11
,
2
),
(
7
,
4
,
40
,
2
);
INSERT
t2
VALUES
(
2
,
1
,
11
,
2
),
(
7
,
4
,
40
,
2
);
INSERT
t1
SELECT
x
,
y
,
z
FROM
t2
WHERE
d
=
1
ON
DUPLICATE
KEY
UPDATE
c
=
c
+
100
;
INSERT
t1
SELECT
a
,
b
,
c
FROM
t2
WHERE
d
=
1
ON
DUPLICATE
KEY
UPDATE
c
=
c
+
100
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
INSERT
t1
SET
a
=
5
ON
DUPLICATE
KEY
UPDATE
b
=
0
;
INSERT
t1
SET
a
=
5
ON
DUPLICATE
KEY
UPDATE
b
=
0
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
INSERT
t1
SELECT
x
,
y
,
z
FROM
t2
WHERE
d
=
2
ON
DUPLICATE
KEY
UPDATE
c
=
c
+
VALUES
(
a
);
INSERT
t1
SELECT
a
,
b
,
c
FROM
t2
WHERE
d
=
2
ON
DUPLICATE
KEY
UPDATE
c
=
c
+
VALUES
(
a
);
SELECT
*
,
VALUES
(
a
)
FROM
t1
;
SELECT
*
,
VALUES
(
a
)
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t2
;
DROP
TABLE
t2
;
sql/sql_insert.cc
View file @
36c146c7
...
@@ -671,6 +671,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
...
@@ -671,6 +671,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
bool
insert_into_view
=
(
table_list
->
view
!=
0
);
bool
insert_into_view
=
(
table_list
->
view
!=
0
);
/* TODO: use this condition for 'WITH CHECK OPTION' */
/* TODO: use this condition for 'WITH CHECK OPTION' */
bool
res
;
bool
res
;
TABLE_LIST
*
next_local
;
DBUG_ENTER
(
"mysql_prepare_insert"
);
DBUG_ENTER
(
"mysql_prepare_insert"
);
DBUG_PRINT
(
"enter"
,
(
"table_list 0x%lx, table 0x%lx, view %d"
,
DBUG_PRINT
(
"enter"
,
(
"table_list 0x%lx, table 0x%lx, view %d"
,
(
ulong
)
table_list
,
(
ulong
)
table
,
(
ulong
)
table_list
,
(
ulong
)
table
,
...
@@ -687,6 +688,8 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
...
@@ -687,6 +688,8 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
select_insert
))
select_insert
))
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
next_local
=
table_list
->
next_local
;
table_list
->
next_local
=
0
;
if
((
values
&&
check_insert_fields
(
thd
,
table_list
,
fields
,
*
values
,
1
,
if
((
values
&&
check_insert_fields
(
thd
,
table_list
,
fields
,
*
values
,
1
,
!
insert_into_view
))
||
!
insert_into_view
))
||
(
values
&&
setup_fields
(
thd
,
0
,
table_list
,
*
values
,
0
,
0
,
0
))
||
(
values
&&
setup_fields
(
thd
,
0
,
table_list
,
*
values
,
0
,
0
,
0
))
||
...
@@ -697,6 +700,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
...
@@ -697,6 +700,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
res
)
||
res
)
||
setup_fields
(
thd
,
0
,
table_list
,
update_values
,
1
,
0
,
0
))))
setup_fields
(
thd
,
0
,
table_list
,
update_values
,
1
,
0
,
0
))))
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
table_list
->
next_local
=
next_local
;
if
(
!
table
)
if
(
!
table
)
table
=
table_list
->
table
;
table
=
table_list
->
table
;
...
...
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