Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions enginetest/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -10751,6 +10751,10 @@ var ErrorQueries = []QueryErrorTest{
Query: "SELECT i FROM myhistorytable AS OF MAX(i)",
ExpectedErr: sql.ErrInvalidAsOfExpression,
},
{
Query: "SELECT i FROM myhistorytable AS OF (SELECT 1)",
ExpectedErrStr: "invalid AS OF expression type",
},
{
Query: "SELECT pk FROM one_pk WHERE pk > ?",
ExpectedErr: sql.ErrUnboundPreparedStatementVariable,
Expand Down
2 changes: 2 additions & 0 deletions sql/planbuilder/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ func (b *Builder) buildAsOfExpr(inScope *scope, time ast.Expr) sql.Expression {
err := sql.ErrInvalidAsOfExpression.New(v)
b.handleErr(err)
}
case *ast.Subquery:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there anyway we could easily extend this a bit? should the default be an error? would we need a whitelist of acceptable exprs? longer blacklist of non-acceptable exprs?

b.handleErr(fmt.Errorf("invalid AS OF expression type"))
default:
}
return b.buildScalar(b.newScope(), time)
Expand Down
Loading