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

importinto: fix panic when import to a temporary table, disallow import to cached table #55983

Merged
merged 3 commits into from
Sep 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix comment
  • Loading branch information
D3Hunter committed Sep 10, 2024
commit 580aa435fb49a27c0aa23bb78c2df6d48e5c2813
7 changes: 4 additions & 3 deletions pkg/planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -4389,9 +4389,10 @@ func (b *PlanBuilder) buildImportInto(ctx context.Context, ld *ast.ImportIntoStm
}

tnW := b.resolveCtx.GetTableName(ld.Table)
if tnW.TableInfo.TempTableType != model.TempTableNone ||
tnW.TableInfo.TableCacheStatusType != model.TableCacheStatusDisable {
return nil, errors.Errorf("IMPORT INTO does not support temporary table or cached table")
if tnW.TableInfo.TempTableType != model.TempTableNone {
return nil, errors.Errorf("IMPORT INTO does not support temporary table")
} else if tnW.TableInfo.TableCacheStatusType != model.TableCacheStatusDisable {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
} else if tnW.TableInfo.TableCacheStatusType != model.TableCacheStatusDisable {
}
if tnW.TableInfo.TableCacheStatusType != model.TableCacheStatusDisable {

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no difference

return nil, errors.Errorf("IMPORT INTO does not support cached table")
}
p := ImportInto{
Path: ld.Path,
Expand Down