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

executor, planner: ON DUPLICATE UPDATE can refer to un-project col #14412

Merged
merged 18 commits into from
Jan 6, 2021

Conversation

winoros
Copy link
Member

@winoros winoros commented Jan 9, 2020

What problem does this PR solve?

Issue Number: to fix #14164

What is changed and how it works?

What's Changed:

MySQL can get the column though it's not in the insert's SELECT stmt.
To solve this, i add the possible column to select's project result.
It's ugly in fact.

Related changes

  • planner/core

Check List

Tests

  • Unit test

Release note

  • ON DUPLICATE UPDATE can refer to un-project col

@winoros winoros requested a review from a team as a code owner January 9, 2020 06:35
@ghost ghost requested review from eurekaka and lzmhhh123 and removed request for a team January 9, 2020 06:35
@winoros winoros requested review from jackysp and lysu January 9, 2020 06:35
tk.MustExec("insert into b values(1, 2)")
tk.MustExec("insert into a select x from b ON DUPLICATE KEY UPDATE a.x=b.y")
c.Assert(tk.Se.AffectedRows(), Equals, uint64(2))
tk.MustQuery("select * from a").Check(testkit.Rows("2"))
Copy link
Member

Choose a reason for hiding this comment

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

Could you add some tests about values() function?

sessionctx/variable/session.go Outdated Show resolved Hide resolved
planner/core/planbuilder.go Outdated Show resolved Hide resolved
planner/core/planbuilder.go Outdated Show resolved Hide resolved
planner/core/planbuilder.go Outdated Show resolved Hide resolved
planner/core/planbuilder.go Outdated Show resolved Hide resolved
@lysu lysu requested a review from coocood January 9, 2020 08:48
@zz-jason zz-jason added this to In Progress in SIG Planner Kanban via automation Mar 10, 2020
@lzmhhh123 lzmhhh123 removed their request for review May 14, 2020 04:54
Co-authored-by: Kenan Yao <cauchy1992@gmail.com>
@winoros winoros requested a review from a team as a code owner January 4, 2021 08:04
@winoros winoros requested review from wshwsh12 and removed request for a team January 4, 2021 08:04
lysu
lysu previously approved these changes Jan 6, 2021
@winoros
Copy link
Member Author

winoros commented Jan 6, 2021

/run-common-test

@winoros
Copy link
Member Author

winoros commented Jan 6, 2021

/run-common-test

@winoros
Copy link
Member Author

winoros commented Jan 6, 2021

/run-integration-common-test

@qw4990
Copy link
Contributor

qw4990 commented Jan 6, 2021

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@winoros merge failed.

@qw4990
Copy link
Contributor

qw4990 commented Jan 6, 2021

/run-unit-test

@winoros winoros merged commit c7165bc into pingcap:master Jan 6, 2021
SIG Planner Kanban automation moved this from PR: In Progress to PR: Done Jan 6, 2021
@winoros winoros deleted the strange-mysql-comp branch January 6, 2021 11:03
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jan 6, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Jan 6, 2021
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/executor component/expression sig/execution SIG execution sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. status/LGT3 The PR has already had 3 LGTM. type/compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

can't find schema when insert into ON DUPLICATE
8 participants