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
c99e953a
Commit
c99e953a
authored
Apr 27, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-new-maint
into polly.local:/home/kaa/src/maint/mysql-5.1-maint
parents
371f80c5
dd2c1b71
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
9 deletions
+99
-9
mysql-test/r/update.result
mysql-test/r/update.result
+35
-0
mysql-test/t/update.test
mysql-test/t/update.test
+55
-0
sql/sql_update.cc
sql/sql_update.cc
+9
-9
No files found.
mysql-test/r/update.result
View file @
c99e953a
...
...
@@ -457,3 +457,38 @@ a quux
2 0.100000000000000000000000000000
3 NULL
DROP TABLE t1;
set tmp_table_size=1024;
create table t1 (id int, a int, key idx(a));
create table t2 (id int unsigned not null auto_increment primary key, a int);
insert into t2(a) values(1),(2),(3),(4),(5),(6),(7),(8);
insert into t2(a) select a from t2;
insert into t2(a) select a from t2;
insert into t2(a) select a from t2;
update t2 set a=id;
insert into t1 select * from t2;
select count(*) from t1 join t2 on (t1.a=t2.a);
count(*)
64
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
affected rows: 0
info: Rows matched: 64 Changed: 0 Warnings: 0
insert into t2(a) select a from t2;
update t2 set a=id;
truncate t1;
insert into t1 select * from t2;
select count(*) from t1 join t2 on (t1.a=t2.a);
count(*)
128
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
affected rows: 0
info: Rows matched: 128 Changed: 0 Warnings: 0
update t1 set a=1;
update t2 set a=1;
select count(*) from t1 join t2 on (t1.a=t2.a);
count(*)
16384
update t1 join t2 on (t1.a=t2.a) set t1.id=t2.id;
affected rows: 127
info: Rows matched: 128 Changed: 127 Warnings: 0
drop table t1,t2;
End of 5.0 tests
mysql-test/t/update.test
View file @
c99e953a
...
...
@@ -376,3 +376,58 @@ INSERT INTO t1( a )
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
#
# Bug #22364: Inconsistent "matched rows" when executing UPDATE
#
connect
(
con1
,
localhost
,
root
,,
test
);
connection
con1
;
set
tmp_table_size
=
1024
;
# Create the test tables
create
table
t1
(
id
int
,
a
int
,
key
idx
(
a
));
create
table
t2
(
id
int
unsigned
not
null
auto_increment
primary
key
,
a
int
);
insert
into
t2
(
a
)
values
(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
);
insert
into
t2
(
a
)
select
a
from
t2
;
insert
into
t2
(
a
)
select
a
from
t2
;
insert
into
t2
(
a
)
select
a
from
t2
;
update
t2
set
a
=
id
;
insert
into
t1
select
*
from
t2
;
# Check that the number of matched rows is correct when the temporary
# table is small enough to not be converted to MyISAM
select
count
(
*
)
from
t1
join
t2
on
(
t1
.
a
=
t2
.
a
);
--
enable_info
update
t1
join
t2
on
(
t1
.
a
=
t2
.
a
)
set
t1
.
id
=
t2
.
id
;
--
disable_info
# Increase table sizes
insert
into
t2
(
a
)
select
a
from
t2
;
update
t2
set
a
=
id
;
truncate
t1
;
insert
into
t1
select
*
from
t2
;
# Check that the number of matched rows is correct when the temporary
# table has to be converted to MyISAM
select
count
(
*
)
from
t1
join
t2
on
(
t1
.
a
=
t2
.
a
);
--
enable_info
update
t1
join
t2
on
(
t1
.
a
=
t2
.
a
)
set
t1
.
id
=
t2
.
id
;
--
disable_info
# Check that the number of matched rows is correct when there are duplicate
# key errors
update
t1
set
a
=
1
;
update
t2
set
a
=
1
;
select
count
(
*
)
from
t1
join
t2
on
(
t1
.
a
=
t2
.
a
);
--
enable_info
update
t1
join
t2
on
(
t1
.
a
=
t2
.
a
)
set
t1
.
id
=
t2
.
id
;
--
disable_info
drop
table
t1
,
t2
;
connection
default
;
disconnect
con1
;
--
echo
End
of
5.0
tests
sql/sql_update.cc
View file @
c99e953a
...
...
@@ -1478,18 +1478,18 @@ bool multi_update::send_data(List<Item> ¬_used_values)
memcpy
((
char
*
)
tmp_table
->
field
[
0
]
->
ptr
,
(
char
*
)
table
->
file
->
ref
,
table
->
file
->
ref_length
);
/* Write row, ignoring duplicated updates to a row */
if
((
error
=
tmp_table
->
file
->
ha_write_row
(
tmp_table
->
record
[
0
])))
error
=
tmp_table
->
file
->
ha_write_row
(
tmp_table
->
record
[
0
]);
if
(
error
!=
HA_ERR_FOUND_DUPP_KEY
&&
error
!=
HA_ERR_FOUND_DUPP_UNIQUE
)
{
if
(
tmp_table
->
file
->
is_fatal_error
(
error
,
HA_CHECK_DUP
)
&&
if
(
error
&&
create_myisam_from_heap
(
thd
,
tmp_table
,
tmp_table_param
+
offset
,
error
,
1
))
{
do_update
=
0
;
DBUG_RETURN
(
1
);
// Not a table_is_full error
}
}
else
tmp_table_param
+
offset
,
error
,
1
))
{
do_update
=
0
;
DBUG_RETURN
(
1
);
// Not a table_is_full error
}
found
++
;
}
}
}
DBUG_RETURN
(
0
);
...
...
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