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

update subquery table should be forbidden #7237

Closed
lysu opened this issue Aug 1, 2018 · 1 comment · Fixed by #7783
Closed

update subquery table should be forbidden #7237

lysu opened this issue Aug 1, 2018 · 1 comment · Fixed by #7783

Comments

@lysu
Copy link
Contributor

lysu commented Aug 1, 2018

  1. What did you do?

prepare two table and a record.

create table a (k int, v int);
create table b (k int, v int);
insert into a values (1, 1);

update b using

update a, (select b.k k, b.v v from b) v set v.v = 3, a.v = 3 where a.k = v.k;
  1. What did you expect to see?
ERROR 1288 (HY000): The target table b of the UPDATE is not updatable
  1. What did you see instead?
Query OK, 1 row affected (0.11 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
2.0.5
@longfeiss
Copy link

update a, (select b.k k, b.v v from b) v set v.v = 3, a.v = 3 where a.k = v.k1;

update a, (select b.k k, b.v v from b) v set v.v = 3, a.v = 3 where a.k = v.k;

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.

2 participants