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
7bd0d02b
Commit
7bd0d02b
authored
Apr 05, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed st_select_lex initialization
fixed mustiupdate subselect compatibility (bug 217)
parent
05982c85
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
4 deletions
+40
-4
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+17
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+17
-0
sql/sql_update.cc
sql/sql_update.cc
+4
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
No files found.
mysql-test/r/subselect.result
View file @
7bd0d02b
...
...
@@ -1082,3 +1082,20 @@ Invalid use of group function
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
Invalid use of group function
drop table t1;
CREATE TABLE t1 (
id int(11) default NULL
) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1),(1),(2),(2),(1),(3);
CREATE TABLE t2 (
id int(11) default NULL,
name varchar(15) default NULL
) TYPE=MyISAM CHARSET=latin1;
INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
select * from t2;
id name
4 vita
1 lenka
2 lenka
1 lenka
drop table t1,t2;
mysql-test/t/subselect.test
View file @
7bd0d02b
...
...
@@ -673,3 +673,20 @@ UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
--
error
1111
UPDATE
t1
SET
i
=
i
+
1
WHERE
i
=
(
SELECT
MAX
(
i
));
drop
table
t1
;
#
# Multi update test
#
CREATE
TABLE
t1
(
id
int
(
11
)
default
NULL
)
TYPE
=
MyISAM
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
1
),(
1
),(
2
),(
2
),(
1
),(
3
);
CREATE
TABLE
t2
(
id
int
(
11
)
default
NULL
,
name
varchar
(
15
)
default
NULL
)
TYPE
=
MyISAM
CHARSET
=
latin1
;
INSERT
INTO
t2
VALUES
(
4
,
'vita'
),
(
1
,
'vita'
),
(
2
,
'vita'
),
(
1
,
'vita'
);
update
t1
,
t2
set
t2
.
name
=
'lenka'
where
t2
.
id
in
(
select
id
from
t1
);
select
*
from
t2
;
drop
table
t1
,
t2
;
sql/sql_update.cc
View file @
7bd0d02b
...
...
@@ -400,6 +400,7 @@ int mysql_multi_update(THD *thd,
table_list
->
grant
.
want_privilege
=
(
SELECT_ACL
&
~
table_list
->
grant
.
privilege
);
if
((
res
=
open_and_lock_tables
(
thd
,
table_list
)))
DBUG_RETURN
(
res
);
fix_tables_pointers
(
thd
->
lex
.
all_selects_list
);
thd
->
select_limit
=
HA_POS_ERROR
;
if
(
setup_fields
(
thd
,
0
,
table_list
,
*
fields
,
1
,
0
,
0
))
...
...
@@ -408,7 +409,7 @@ int mysql_multi_update(THD *thd,
/*
Count tables and setup timestamp handling
*/
for
(
tl
=
(
TABLE_LIST
*
)
table_list
;
tl
;
tl
=
tl
->
next
)
for
(
tl
=
select_lex
->
get_table_list
()
;
tl
;
tl
=
tl
->
next
)
{
TABLE
*
table
=
tl
->
table
;
if
(
table
->
timestamp_field
)
...
...
@@ -426,7 +427,8 @@ int mysql_multi_update(THD *thd,
List
<
Item
>
total_list
;
res
=
mysql_select
(
thd
,
&
select_lex
->
ref_pointer_array
,
table_list
,
select_lex
->
with_wild
,
total_list
,
select_lex
->
get_table_list
(),
select_lex
->
with_wild
,
total_list
,
conds
,
0
,
(
ORDER
*
)
NULL
,
(
ORDER
*
)
NULL
,
(
Item
*
)
NULL
,
(
ORDER
*
)
NULL
,
options
|
SELECT_NO_JOIN_CACHE
|
SELECT_NO_UNLOCK
,
...
...
sql/sql_yacc.yy
View file @
7bd0d02b
...
...
@@ -3369,8 +3369,8 @@ update:
UPDATE_SYM
{
LEX *lex= Lex;
mysql_init_select(lex);
lex->sql_command= SQLCOM_UPDATE;
lex->select_lex.init_order();
}
opt_low_priority opt_ignore join_table_list
SET update_list where_clause opt_order_clause delete_limit_clause
...
...
@@ -3378,7 +3378,7 @@ update:
LEX *lex= Lex;
Select->set_lock_for_tables($3);
if (lex->select_lex.table_list.elements > 1)
lex->sql_command=SQLCOM_UPDATE_MULTI;
lex->sql_command=
SQLCOM_UPDATE_MULTI;
}
;
...
...
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