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

planner: update generated column inside a transaction should return error #8909

Merged
merged 5 commits into from
Jan 3, 2019

Conversation

zz-jason
Copy link
Member

@zz-jason zz-jason commented Jan 2, 2019

What problem does this PR solve?

drop table if exists t;
create table t(a bigint, b bigint as (a+1));
begin;
insert into t(a) values(1);
update t set b=6 where b=7; -- got panic here
commit;

RCA:
Inside a transaction, DataSource is converted to LogicalUnionScan, we should also consider this case when we extract table alias name in update statement for virtual generated columns.

What is changed and how it works?

also check LogicalUnionScan, if it is, use its child to extract table alias name.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note

This change is Reviewable

@zz-jason zz-jason added type/bugfix This PR fixes a bug. sig/planner SIG: Planner labels Jan 2, 2019
@zz-jason
Copy link
Member Author

zz-jason commented Jan 2, 2019

/run-all-tests

executor/update_test.go Outdated Show resolved Hide resolved
@zz-jason zz-jason requested a review from eurekaka January 2, 2019 14:12
Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eurekaka eurekaka added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 3, 2019
Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alivxxx alivxxx added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 3, 2019
@zz-jason zz-jason merged commit 386f8e3 into pingcap:master Jan 3, 2019
@zz-jason zz-jason deleted the pquery/update-gene-col-txn branch January 3, 2019 03:01
zz-jason added a commit to zz-jason/tidb that referenced this pull request Jan 8, 2019
zz-jason added a commit to zz-jason/tidb that referenced this pull request Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants