mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
bugfix: update-behind-insert
sql_insert.cc calls handler->ha_update_row() for REPLACE and INSERT... ON DUPLICATE KEY UPDATE
This commit is contained in:
@@ -35,3 +35,11 @@ index(c(100), d(20)));
|
|||||||
insert t1 (a,b,h) values (repeat('g', 10000), repeat('x', 2800), 1);
|
insert t1 (a,b,h) values (repeat('g', 10000), repeat('x', 2800), 1);
|
||||||
update t1 set a = repeat(cast(1 as char), 2000);
|
update t1 set a = repeat(cast(1 as char), 2000);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1(a blob not null, b int, c varbinary (10) generated always as (a) virtual, unique (c(9)));
|
||||||
|
insert t1 (a,b) values ('a', 1);
|
||||||
|
replace t1 set a = 'a',b =1;
|
||||||
|
insert t1 (a,b) values ('a', 1) on duplicate key update a='b', b=2;
|
||||||
|
select * from t1;
|
||||||
|
a b c
|
||||||
|
b 2 b
|
||||||
|
drop table t1;
|
||||||
|
@@ -46,3 +46,12 @@ create table t1 (
|
|||||||
insert t1 (a,b,h) values (repeat('g', 10000), repeat('x', 2800), 1);
|
insert t1 (a,b,h) values (repeat('g', 10000), repeat('x', 2800), 1);
|
||||||
update t1 set a = repeat(cast(1 as char), 2000);
|
update t1 set a = repeat(cast(1 as char), 2000);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# UPDATE disguised as INSERT
|
||||||
|
#
|
||||||
|
create table t1(a blob not null, b int, c varbinary (10) generated always as (a) virtual, unique (c(9)));
|
||||||
|
insert t1 (a,b) values ('a', 1);
|
||||||
|
replace t1 set a = 'a',b =1;
|
||||||
|
insert t1 (a,b) values ('a', 1) on duplicate key update a='b', b=2;
|
||||||
|
select * from t1;
|
||||||
|
drop table t1;
|
||||||
|
@@ -1696,6 +1696,12 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
|||||||
HA_READ_KEY_EXACT))))
|
HA_READ_KEY_EXACT))))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
if (table->vfield)
|
||||||
|
{
|
||||||
|
table->move_fields(table->field, table->record[1], table->record[0]);
|
||||||
|
table->update_virtual_fields(VCOL_UPDATE_INDEXED);
|
||||||
|
table->move_fields(table->field, table->record[0], table->record[1]);
|
||||||
|
}
|
||||||
if (info->handle_duplicates == DUP_UPDATE)
|
if (info->handle_duplicates == DUP_UPDATE)
|
||||||
{
|
{
|
||||||
int res= 0;
|
int res= 0;
|
||||||
|
Reference in New Issue
Block a user