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

Return wrong result when UPDATE's assignment_list has subquery #25658

Closed
hawkingrei opened this issue Jun 22, 2021 · 1 comment · Fixed by #25660
Closed

Return wrong result when UPDATE's assignment_list has subquery #25658

hawkingrei opened this issue Jun 22, 2021 · 1 comment · Fixed by #25660
Labels
severity/critical sig/planner SIG: Planner type/bug This issue is a bug.

Comments

@hawkingrei
Copy link
Member

hawkingrei commented Jun 22, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `users` (
  `id` bigint(20) unsigned NOT NULL,
  `name` longtext DEFAULT NULL,
  `age` bigint(20) unsigned DEFAULT NULL,
  `company_id` bigint(20) DEFAULT NULL,
  `manager_id` bigint(20) unsigned DEFAULT NULL,
  `active` tinyint(1) DEFAULT NULL,
  `created_at` datetime(3) DEFAULT NULL,
  `updated_at` datetime(3) DEFAULT NULL,
  `deleted_at` datetime(3) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_users_deleted_at` (`deleted_at`)
);
insert into users(id, company_id, name, updated_at) values(239, 15, 'Company 2 id 15', '2021-03-01 12:12:12.987');
create table companies(id bigint primary key, name longtext default null);
insert into companies values(14, 'Company 1 id 14');
insert into companies values(15, 'Company 2 id 15');
UPDATE `users` SET `company_id`=14,`name`=(SELECT `name` FROM `companies` WHERE companies.id = users.company_id),`updated_at`='2021-04-27 10:28:31.459' WHERE `id` = 239;

2. What did you expect to see? (Required)

select * from users;

name is not null

3. What did you see instead (Required)

image

but it is null

4. What is your TiDB version? (Required)

master branch

@hawkingrei hawkingrei added the type/bug This issue is a bug. label Jun 22, 2021
@github-actions github-actions bot added this to Issue Backlog: Need Triage in SIG Planner Kanban Jun 22, 2021
SIG Planner Kanban automation moved this from Issue Backlog: Need Triage to Coding Finished (This Week) Jun 22, 2021
@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/planner SIG: Planner type/bug This issue is a bug.
Projects
No open projects
SIG Planner Kanban
  
Coding Finished (This Week)
3 participants