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

Projects
None yet
3 participants
@zz-jason
Copy link
Member

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

This comment has been minimized.

Copy link
Member

zz-jason commented Jan 2, 2019

/run-all-tests

Show resolved Hide resolved executor/update_test.go Outdated

@zz-jason zz-jason requested a review from eurekaka Jan 2, 2019

@eurekaka
Copy link
Contributor

eurekaka left a comment

LGTM

@eurekaka eurekaka added the status/LGT1 label Jan 3, 2019

@lamxTyler
Copy link
Member

lamxTyler left a comment

LGTM

@lamxTyler lamxTyler added status/LGT2 and removed status/LGT1 labels Jan 3, 2019

@zz-jason zz-jason merged commit 386f8e3 into pingcap:master Jan 3, 2019

4 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
idc-jenkins-ci-tidb/build Jenkins job succeeded.
Details
license/cla Contributor License Agreement is signed.
Details

@zz-jason zz-jason deleted the zz-jason:pquery/update-gene-col-txn branch Jan 3, 2019

zz-jason added a commit to zz-jason/tidb that referenced this pull request Jan 8, 2019

zz-jason added a commit that referenced this pull request Jan 9, 2019

zz-jason added a commit to zz-jason/tidb that referenced this pull request Jan 15, 2019

jackysp added a commit that referenced this pull request Jan 16, 2019

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