-
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
plan: fix concat in group statement #7448
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1171,6 +1171,14 @@ func (s *testPlanSuite) TestValidate(c *C) { | |
sql: "select a from t having sum(avg(a))", | ||
err: ErrInvalidGroupFuncUse, | ||
}, | ||
{ | ||
sql: "select concat(c_str, d_str) from t group by `concat(c_str, d_str)`", | ||
err: nil, | ||
}, | ||
{ | ||
sql: "select concat(c_str, d_str) from t group by `concat(c_str,d_str)`", | ||
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. This should not result in an error. 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. this is the result of mysql: MySQL(localhost:3306) > select concat(k1, k2) from t group by concat(k1,k2);
+----------------+
| concat(k1, k2) |
+----------------+
| 12 |
+----------------+
1 row in set (0.01 sec) 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.
`concat(k1,k2)` is different from concat(k1,k2). 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. 😂 Got it 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. It'll be better to add the test case 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. @XuHuaiyu TiDB always support this case.😂 |
||
err: ErrUnknownColumn, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
sql := tt.sql | ||
|
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.
it's better to add a comment here to explain why we add this check and what issue it fixes.
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.
ok