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

Regression in INSERT ... SELECT query introduced in release-8.0 #8638

Closed
GuptaManan100 opened this issue Aug 17, 2021 · 0 comments · Fixed by #8662
Closed

Regression in INSERT ... SELECT query introduced in release-8.0 #8638

GuptaManan100 opened this issue Aug 17, 2021 · 0 comments · Fixed by #8662

Comments

@GuptaManan100
Copy link
Member

Overview of the Issue

Consider the following query -

INSERT INTO main.user_privacy_consents (user_id, accepted_at)  SELECT user_id, accepted_at FROM (SELECT 1 as user_id, 1629194864 as accepted_at) AS tmp WHERE NOT EXISTS (SELECT user_id FROM main.user_privacy_consents WHERE user_id = 1)

This query produces the following plan in release-7.0 via V3

{
  "QueryType": "INSERT",
  "Original": "INSERT INTO main.user_privacy_consents (user_id, accepted_at)  SELECT user_id, accepted_at FROM (SELECT 1 as user_id, 1629194864 as accepted_at) AS tmp WHERE NOT EXISTS (SELECT user_id FROM main.user_privacy_consents WHERE user_id = 1)",
  "Instructions": {
    "OperatorType": "Insert",
    "Variant": "Unsharded",
    "Keyspace": {
      "Name": "main",
      "Sharded": false
    },
    "TargetTabletType": "MASTER",
    "MultiShardAutocommit": false,
    "Query": "insert into user_privacy_consents(user_id, accepted_at) select user_id, accepted_at from (select 1 as user_id, 1629194864 as accepted_at from dual) as tmp where not exists (select user_id from user_privacy_consents where user_id = 1)",
    "TableName": "user_privacy_consents"
  }
}

However, in release-8.0, the following error is seen -

unsupported: sharded subquery in insert values

Reproduction Steps

Steps to reproduce this issue, example:

  1. Copy the given query in one_case.txt and run TestOne from plan_test.go

Binary version

Regression introduced in release-8.0

@frouioui frouioui self-assigned this Aug 19, 2021
@systay systay self-assigned this Aug 23, 2021
systay added a commit to planetscale/vitess that referenced this issue Aug 23, 2021
systay added a commit to planetscale/vitess that referenced this issue Aug 23, 2021
systay added a commit to planetscale/vitess that referenced this issue Aug 23, 2021
systay added a commit to planetscale/vitess that referenced this issue Aug 23, 2021
systay added a commit to planetscale/vitess that referenced this issue Aug 23, 2021
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.

3 participants