diff options
author | Jorgen Loland <jorgen.loland@oracle.com> | 2011-06-16 08:24:00 +0200 |
---|---|---|
committer | Jorgen Loland <jorgen.loland@oracle.com> | 2011-06-16 08:24:00 +0200 |
commit | 5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (patch) | |
tree | 32635dc09bff582bae4370798dbd6f8dc204dc61 /sql/sql_parse.h | |
parent | 4e4e09ea5083f4e7d88aa248c9424953c9162e0a (diff) | |
download | mariadb-git-5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a.tar.gz |
BUG#11882110: UPDATE REPORTS ER_KEY_NOT_FOUND IF TABLE IS
UPDATED TWICE
For multi update it is not allowed to update a column
of a table if that table is accessed through multiple aliases
and either
1) the updated column is used as partitioning key
2) the updated column is part of the primary key
and the primary key is clustered
This check is done in unsafe_key_update().
The bug was that for case 2), it was checked whether
updated_column_number == table_share->primary_key
However, the primary_key variable is the index number of the
primary key, not a column number.
Prior to this bugfix, the first column was wrongly believed to be
the primary key. The columns covered by an index is found in
table->key_info[idx_number]->key_part. The bugfix is to check if
any of the columns in the keyparts of the primary key are
updated.
The user-visible effect is that for storage engines with
clustered primary key (e.g. InnoDB but not MyISAM) queries
like
"UPDATE t1 AS A JOIN t2 AS B SET A.primkey=..."
will now error with
"ERROR HY000: Primary key/partition key update is not allowed
since the table is updated both as 'A' and 'B'."
instead of
"ERROR 1032 (HY000): Can't find record in 't1_tb'"
even if primkey is not the first column in the table. This
was the intended behavior of bugfix 11764529.
mysql-test/r/multi_update.result:
Add test for bug#11882110
mysql-test/r/multi_update_innodb.result:
Add test for bug#11882110
mysql-test/t/multi_update.test:
Add test for bug#11882110
mysql-test/t/multi_update_innodb.test:
Add test for bug#11882110
sql/sql_update.cc:
unsafe_key_update() wrongly checked if the primary key index
number was the same as updated column number. Now it is checked
whether any of the columns making up the primary key is updated.
sql/table.h:
Fix comment on TABLE_SHARE::primary_key. Incorrect comment
was introduced by an earlier merge conflict (as per dlenev)
Diffstat (limited to 'sql/sql_parse.h')
0 files changed, 0 insertions, 0 deletions