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
b6f3a373
Commit
b6f3a373
authored
Jul 15, 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
7768acb6
cc57265b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletion
+30
-1
mysql-test/r/update.result
mysql-test/r/update.result
+11
-0
mysql-test/t/update.test
mysql-test/t/update.test
+13
-0
sql/sql_select.cc
sql/sql_select.cc
+6
-1
No files found.
mysql-test/r/update.result
View file @
b6f3a373
...
@@ -240,3 +240,14 @@ update t1, t2 set t1.a = t2.a where t2.b = t1.b;
...
@@ -240,3 +240,14 @@ update t1, t2 set t1.a = t2.a where t2.b = t1.b;
show warnings;
show warnings;
Level Code Message
Level Code Message
drop table t1, t2;
drop table t1, t2;
create table t1(f1 int, f2 int);
create table t2(f3 int, f4 int);
create index idx on t2(f3);
insert into t1 values(1,0),(2,0);
insert into t2 values(1,1),(2,2);
UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
select * from t1;
f1 f2
1 1
2 2
drop table t1,t2;
mysql-test/t/update.test
View file @
b6f3a373
...
@@ -201,3 +201,16 @@ analyze table t1,t2;
...
@@ -201,3 +201,16 @@ analyze table t1,t2;
update
t1
,
t2
set
t1
.
a
=
t2
.
a
where
t2
.
b
=
t1
.
b
;
update
t1
,
t2
set
t1
.
a
=
t2
.
a
where
t2
.
b
=
t1
.
b
;
show
warnings
;
show
warnings
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# Bug #11868 Update with subquery with ref built with a key from the updated
# table crashes server
#
create
table
t1
(
f1
int
,
f2
int
);
create
table
t2
(
f3
int
,
f4
int
);
create
index
idx
on
t2
(
f3
);
insert
into
t1
values
(
1
,
0
),(
2
,
0
);
insert
into
t2
values
(
1
,
1
),(
2
,
2
);
UPDATE
t1
SET
t1
.
f2
=
(
SELECT
MAX
(
t2
.
f4
)
FROM
t2
WHERE
t2
.
f3
=
t1
.
f1
);
select
*
from
t1
;
drop
table
t1
,
t2
;
sql/sql_select.cc
View file @
b6f3a373
...
@@ -3555,7 +3555,12 @@ static void add_not_null_conds(JOIN *join)
...
@@ -3555,7 +3555,12 @@ static void add_not_null_conds(JOIN *join)
DBUG_ASSERT
(
item
->
type
()
==
Item
::
FIELD_ITEM
);
DBUG_ASSERT
(
item
->
type
()
==
Item
::
FIELD_ITEM
);
Item_field
*
not_null_item
=
(
Item_field
*
)
item
;
Item_field
*
not_null_item
=
(
Item_field
*
)
item
;
JOIN_TAB
*
referred_tab
=
not_null_item
->
field
->
table
->
reginfo
.
join_tab
;
JOIN_TAB
*
referred_tab
=
not_null_item
->
field
->
table
->
reginfo
.
join_tab
;
if
(
referred_tab
->
join
!=
join
)
/*
For UPDATE queries such as:
UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1);
not_null_item is the t1.f1, but it's referred_tab is 0.
*/
if
(
!
referred_tab
||
referred_tab
->
join
!=
join
)
continue
;
continue
;
Item
*
notnull
;
Item
*
notnull
;
if
(
!
(
notnull
=
new
Item_func_isnotnull
(
not_null_item
)))
if
(
!
(
notnull
=
new
Item_func_isnotnull
(
not_null_item
)))
...
...
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