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 Allows updating a child to value -0 when the parent has 0 if the update is done via an arithmetic expression #14589

Closed
GuptaManan100 opened this issue Nov 23, 2023 · 0 comments · Fixed by #14555

Comments

@GuptaManan100
Copy link
Member

GuptaManan100 commented Nov 23, 2023

Overview of the Issue

This bug was found by the fuzzer introduced in #13980.

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;

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

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

create table fk_t19
(
    id bigint,
    col varchar(10),
    primary key (id),
    index(col),
    foreign key (col) references fk_t17(col) on delete set null on update set null
) 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 (2, '-0');
insert /*+ SET_VAR(foreign_key_checks=0) */ into fk_t16 (id, col) values (3, '5'), (4, '-5')

Now if you run the query - update fk_t16 set col = col * (col - (col)) where id = 3,
you'll see that Vitess allows this query even though MySQL rejects it.

Linked to the bug #14523

Reproduction Steps

Given in the description

Binary Version

main

Operating System and Environment details

-

Log Fragments

No response

@GuptaManan100 GuptaManan100 added Type: Bug Needs Triage This issue needs to be correctly labelled and triaged Component: Query Serving and removed Needs Triage This issue needs to be correctly labelled and triaged labels Nov 23, 2023
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