Skip to content

Commit

Permalink
use StarExpr in FUNC(*)
Browse files Browse the repository at this point in the history
this is the only useful (?) part of my attempts at cockroachdb#1810.
  • Loading branch information
tbg committed Jul 26, 2015
1 parent cdd21fd commit 178858d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sql/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (p *planner) Delete(n *parser.Delete) (planNode, error) {
// deleting.
node, err := p.Select(&parser.Select{
Exprs: parser.SelectExprs{
&parser.StarExpr{TableName: parser.Name(tableDesc.Name)},
&parser.StarExpr{TableName: parser.QualifiedName{tableDesc.Name}},
},
From: parser.TableExprs{n.Table},
Where: n.Where,
Expand Down
5 changes: 3 additions & 2 deletions sql/parser/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ func (*NonStarExpr) selectExpr() {}
// TODO(tschottdorf): needs work, see #1810. TableName is never even referenced
// in the grammar so far.
type StarExpr struct {
TableName Name
Expr
TableName QualifiedName
}

func (node *StarExpr) String() string {
var buf bytes.Buffer
if node.TableName != "" {
if len(node.TableName) != 0 {
fmt.Fprintf(&buf, "%s.", node.TableName)
}
fmt.Fprintf(&buf, "*")
Expand Down
2 changes: 1 addition & 1 deletion sql/parser/sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sql/parser/sql.y
Original file line number Diff line number Diff line change
Expand Up @@ -2938,7 +2938,7 @@ func_application:
}
| func_name '(' '*' ')'
{
$$ = &FuncExpr{Name: $1, Exprs: Exprs{QualifiedName{"*"}}}
$$ = &FuncExpr{Name: $1, Exprs: Exprs{&StarExpr{}}}
}

// func_expr and its cousin func_expr_windowless are split out from c_expr just
Expand Down

0 comments on commit 178858d

Please sign in to comment.