Skip to content

Commit

Permalink
sql: detail the type for unsupported casts using "T() SCONST"
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
knz committed Nov 28, 2018
1 parent bd3bce9 commit 4fad432
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/sql/parser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2656,7 +2656,7 @@ func TestUnimplementedSyntax(t *testing.T) {
{`SELECT 'a'::INTERVAL SECOND(123)`, 0, `interval second with precision`},
{`SELECT (a,b) OVERLAPS (c,d)`, 0, `overlaps`},
{`SELECT UNIQUE (SELECT b)`, 0, `UNIQUE predicate`},
{`SELECT a(b) 'c'`, 0, `func const`},
{`SELECT a(b) 'c'`, 0, `a(...) SCONST`},
{`SELECT INTERVAL(3) 'a'`, 0, `expr_const const_interval`},
{`SELECT GROUPING (a,b,c)`, 0, `d_expr grouping`},
{`SELECT a(VARIADIC b)`, 0, `variadic`},
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/parser/sql.y
Original file line number Diff line number Diff line change
Expand Up @@ -7084,7 +7084,7 @@ d_expr:
{
$$.val = tree.NewBytesStrVal($1)
}
| func_name '(' expr_list opt_sort_clause_err ')' SCONST { return unimplemented(sqllex, "func const") }
| func_name '(' expr_list opt_sort_clause_err ')' SCONST { return unimplemented(sqllex, $1.unresolvedName().String() + "(...) SCONST") }
| const_typename SCONST
{
$$.val = &tree.CastExpr{Expr: tree.NewStrVal($2), Type: $1.colType(), SyntaxMode: tree.CastPrepend}
Expand Down

0 comments on commit 4fad432

Please sign in to comment.