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 Report: Vitess managed foreign key cascades incorrect value #14523

Closed
GuptaManan100 opened this issue Nov 15, 2023 · 0 comments · Fixed by #14524
Closed

Bug Report: Vitess managed foreign key cascades incorrect value #14523

GuptaManan100 opened this issue Nov 15, 2023 · 0 comments · Fixed by #14524

Comments

@GuptaManan100
Copy link
Member

Overview of the Issue

Consider the following schema -

create table fk_t15
(
    id bigint,
    col varchar(10),
    primary key (id),
    index(col)
) Engine = InnoDB;

create table fk_t16
(
    id bigint,
    col varchar(10),
    primary key (id),
    index(col),
    foreign key (col) references fk_t15(col) on delete cascade on update cascade
) Engine = InnoDB;

Configure the keyspace such that Vitess is managing the foreign keys.
Insert the following data into the two tables -

insert into fk_t15 (id, col) values (1, '-5')
insert into fk_t16 (id, col) values (1, '-5')

Now if you run the query - update fk_t15 set col = col * (col - (col)),
you'll see that the foreign key constraints are broken.

In the end, the data in the tables looks like -

select * from fk_t15;
+----+------+
| id | col  |
+----+------+
|  1 | -0   |
+----+------+

select * from fk_t16;
+----+------+
| id | col  |
+----+------+
|  1 |  0   |
+----+------+

Reproduction Steps

Given in the description

Binary Version

main

Operating System and Environment details

all

Log Fragments

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant