Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: incorrect result set.After update trigger,Does not take effect #569

Closed
1 task
shangyanwen opened this issue Sep 26, 2022 · 1 comment
Closed
1 task
Assignees
Labels
A-bug Something isn't working

Comments

@shangyanwen
Copy link
Contributor

Describe the problem

create table t1 (i int)engine=tianmu;
insert into t1 values (1),(2),(3),(4);
create trigger trg after update on t1 for each row
  set @total_change:=@total_change + new.i - old.i;
set @total_change:=0;
update t1 set i=3;
select @total_change;

#Incorrect test results
+---------------+
| @total_change |
+---------------+
|             0 |
+---------------+
1 row in set (0.00 sec)

drop trigger trg;
drop table t1;

Expected behavior

# Correct test results(note:Innodb test verification, test results are as follows)
mysql> select @total_change;
+---------------+
| @total_change |
+---------------+
|             2 |
+---------------+

How To Reproduce

Follow the test steps above

Environment

./mysqld  Ver 5.7.36_v1.0.1_beta-StoneDB for Linux on x86_64 (build-)
build information as follow: 
        Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev
        Branch name: stonedb-5.7-dev
        Last commit ID: 208f79d
        Last commit time: Date:   Sat Sep 17 16:19:42 2022 +0800
        Build time: Date: Sat Sep 17 17:59:04 CST 2022

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

  • Yes, I will!
@shangyanwen shangyanwen added the A-bug Something isn't working label Sep 26, 2022
@shangyanwen shangyanwen added this to the stonedb_5.7_v1.0.1 milestone Sep 26, 2022
@lylth lylth self-assigned this Sep 27, 2022
@shangyanwen shangyanwen changed the title bug: After update trigger,Does not take effect bug: incorrect result set.After update trigger,Does not take effect Sep 29, 2022
@lylth
Copy link
Contributor

lylth commented Oct 9, 2022

This bug has been fixed

mysql> create table t1 (i int)engine=tianmu;
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t1 values (1),(2),(3),(4);
Query OK, 4 rows affected (0.00 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql> create trigger trg after update on t1 for each row
    ->   set @total_change:=@total_change + new.i - old.i;
Query OK, 0 rows affected (0.01 sec)

mysql> set @total_change:=0;
Query OK, 0 rows affected (0.00 sec)

mysql> update t1 set i=3;
Query OK, 3 rows affected (0.01 sec)
Rows matched: 4  Changed: 3  Warnings: 0

mysql> select @total_change;
+---------------+
| @total_change |
+---------------+
|             2 |
+---------------+
1 row in set (0.00 sec)

@lylth lylth closed this as completed Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants