-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
expression: forbidden bind sql when subquery or union exists #27347
Changes from 1 commit
061ac16
81b9b49
1c36a1a
b122f1f
c825c54
7ac1781
56cce2e
5966bc2
02593fb
78bb3b1
5b4a7ae
151e2cd
1e0142c
c21f251
81ce253
025253d
ba379e7
9d2d3b5
7306096
5955ade
4c6de4d
f46cedd
fa28bb8
be844d5
0500429
9554423
3132c1a
89cf8d2
b0af726
bdb423c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -417,11 +417,11 @@ func (p *preprocessor) checkBindGrammar(originNode, hintedNode ast.StmtNode, def | |
resNode = n | ||
case *ast.SetOprStmt: | ||
resNode = n | ||
//TODO: What about insert into (select * from t) | ||
case *ast.DeleteStmt: | ||
resNode = n.TableRefs.TableRefs | ||
case *ast.UpdateStmt: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should also check where expr in Delete/Update There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's open a new issue about Delete/Update/Insert~ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok~ I have created a new issue #27422 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thx a lot, I'm working on it. |
||
resNode = n.TableRefs.TableRefs | ||
//TODO: What about insert into (select * from t) | ||
case *ast.InsertStmt: | ||
resNode = n.Table.TableRefs | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add a unit test for
extractTableList
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a big project. It seems most internal methods in
logic_plan_builder.go
do not have a UT, such asextractTableSourceAsNames
,extractOnCondition
.... and so on. I think it's probably tested by high level.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a unit test is a better practice to prevent explosion of combinations. So even we have some integration tests we still need unit tests to ensure robustness of our code. But I will approve the pr because it is for
forbidden bind sql when subquery or union exists
. We may add a unit test for this method in another PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree to make a specific project to improve the test coverage about
logic_plan_builder.go