stonedb icon indicating copy to clipboard operation
stonedb copied to clipboard

bug: Have to restore default values after update ON DUPLICATE KEY,Execution result error

Open shangyanwen opened this issue 1 year ago • 0 comments

Describe the problem

create table t1 (f1 int)engine=tianmu;
create table t2 (ff1 int unique, ff2 int default 1)engine=tianmu;
insert into t1 values (1),(1),(2);
insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1;

select * from t2;
#Incorrect test results
+------+------+
| ff1  | ff2  |
+------+------+
|    1 |    1 |
|    1 |    1 |
|    2 |    1 |
+------+------+

drop table t1, t2;

Expected behavior

# Correct test results(note:Innodb test verification, test results are as follows)
select * from t2;
+------+------+
| ff1  | ff2  |
+------+------+
|    1 |    2 |
|    2 |    1 |
+------+------+

How To Reproduce

create table t1 (f1 int)engine=tianmu;
create table t2 (ff1 int unique, ff2 int default 1)engine=tianmu;
insert into t1 values (1),(1),(2);
insert into t2(ff1) select f1 from t1 on duplicate key update ff2=ff2+1;
select * from t2;
drop table t1, t2;

Environment

[root@dev bin]# ./mysqld --version
./mysqld  Ver 5.7.36_v1.0.0_beta-StoneDB for Linux on x86_64 (build-)
build information as follow: 
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7
        Branch name: stonedb-5.7
        Last commit ID: eed32f6
        Last commit time: Date:   Wed Aug 3 11:19:48 2022 +0800
        Build time: Date: Wed Aug  3 13:01:31 CST 2022

Are you interested in submitting a PR to solve the problem?

  • [ ] Yes, I will!

shangyanwen avatar Sep 19 '22 03:09 shangyanwen