diff --git a/executor/aggregate_test.go b/executor/aggregate_test.go index abe7a8a92364c..06e632002d0b3 100644 --- a/executor/aggregate_test.go +++ b/executor/aggregate_test.go @@ -565,7 +565,7 @@ func (s *testSuite) TestIssue13652(c *C) { tk.MustQuery("select a from t group by +a") tk.MustQuery("select a from t group by ((+a))") _, err := tk.Exec("select a from t group by (-a)") - c.Assert(err.Error(), Equals, "[planner:1055]Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.t.a' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by") + c.Assert(err.Error(), Equals, "[planner:1055]Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by") } func (s *testSuite) TestHaving(c *C) { diff --git a/planner/core/logical_plan_builder.go b/planner/core/logical_plan_builder.go index b0e532fe733a0..e7440cfc3bd19 100644 --- a/planner/core/logical_plan_builder.go +++ b/planner/core/logical_plan_builder.go @@ -1538,7 +1538,7 @@ func (b *planBuilder) checkOnlyFullGroupByWithGroupClause(p LogicalPlan, sel *as gbyExprs := make([]ast.ExprNode, 0, len(sel.Fields.Fields)) schema := p.Schema() for _, byItem := range sel.GroupBy.Items { - expr := getInnerFromParentheses(byItem.Expr) + expr := getInnerFromParenthesesAndUnaryPlus(byItem.Expr) if colExpr, ok := expr.(*ast.ColumnNameExpr); ok { col, err := schema.FindColumn(colExpr.Name) if err != nil || col == nil {