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
2b69b4ae
Commit
2b69b4ae
authored
Feb 17, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-4.1
into mysql.com:/home/jimw/my/mysql-4.1-clean
parents
3a88e0e0
844277ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
14 deletions
+21
-14
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_parse.cc
sql/sql_parse.cc
+14
-8
No files found.
mysql-test/r/insert_update.result
View file @
2b69b4ae
...
@@ -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 @
2b69b4ae
...
@@ -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_parse.cc
View file @
2b69b4ae
...
@@ -2775,18 +2775,23 @@ mysql_execute_command(THD *thd)
...
@@ -2775,18 +2775,23 @@ mysql_execute_command(THD *thd)
select_lex
->
options
|=
OPTION_BUFFER_RESULT
;
select_lex
->
options
|=
OPTION_BUFFER_RESULT
;
}
}
if
(
!
(
res
=
open_and_lock_tables
(
thd
,
tables
))
&&
if
((
res
=
open_and_lock_tables
(
thd
,
tables
)))
!
(
res
=
mysql_prepare_insert
(
thd
,
tables
,
first_local_table
,
break
;
tables
->
table
,
lex
->
field_list
,
0
,
TABLE
*
table
=
tables
->
table
;
/* Skip first table, which is the table we are inserting in */
tables
=
(
TABLE_LIST
*
)
lex
->
select_lex
.
table_list
.
first
=
(
byte
*
)
first_local_table
->
next
;
first_local_table
->
next
=
0
;
if
(
!
(
res
=
mysql_prepare_insert
(
thd
,
tables
,
first_local_table
,
table
,
lex
->
field_list
,
0
,
lex
->
update_list
,
lex
->
value_list
,
lex
->
update_list
,
lex
->
value_list
,
lex
->
duplicates
))
&&
lex
->
duplicates
))
&&
(
result
=
new
select_insert
(
table
s
->
table
,
&
lex
->
field_list
,
(
result
=
new
select_insert
(
table
,
&
lex
->
field_list
,
&
lex
->
update_list
,
&
lex
->
value_list
,
&
lex
->
update_list
,
&
lex
->
value_list
,
lex
->
duplicates
,
lex
->
ignore
)))
lex
->
duplicates
,
lex
->
ignore
)))
{
{
TABLE
*
table
=
tables
->
table
;
/* Skip first table, which is the table we are inserting in */
lex
->
select_lex
.
table_list
.
first
=
(
byte
*
)
first_local_table
->
next
;
/*
/*
insert/replace from SELECT give its SELECT_LEX for SELECT,
insert/replace from SELECT give its SELECT_LEX for SELECT,
and item_list belong to SELECT
and item_list belong to SELECT
...
@@ -2794,7 +2799,6 @@ mysql_execute_command(THD *thd)
...
@@ -2794,7 +2799,6 @@ mysql_execute_command(THD *thd)
lex
->
select_lex
.
resolve_mode
=
SELECT_LEX
::
SELECT_MODE
;
lex
->
select_lex
.
resolve_mode
=
SELECT_LEX
::
SELECT_MODE
;
res
=
handle_select
(
thd
,
lex
,
result
);
res
=
handle_select
(
thd
,
lex
,
result
);
/* revert changes for SP */
/* revert changes for SP */
lex
->
select_lex
.
table_list
.
first
=
(
byte
*
)
first_local_table
;
lex
->
select_lex
.
resolve_mode
=
SELECT_LEX
::
INSERT_MODE
;
lex
->
select_lex
.
resolve_mode
=
SELECT_LEX
::
INSERT_MODE
;
delete
result
;
delete
result
;
table
->
insert_values
=
0
;
table
->
insert_values
=
0
;
...
@@ -2803,6 +2807,8 @@ mysql_execute_command(THD *thd)
...
@@ -2803,6 +2807,8 @@ mysql_execute_command(THD *thd)
}
}
else
else
res
=
-
1
;
res
=
-
1
;
first_local_table
->
next
=
tables
;
lex
->
select_lex
.
table_list
.
first
=
(
byte
*
)
first_local_table
;
break
;
break
;
}
}
case
SQLCOM_TRUNCATE
:
case
SQLCOM_TRUNCATE
:
...
...
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