handling missing epoch constraint correctly (#2366)

(cherry picked from commit 843312dfc9)
This commit is contained in:
pokeeffe-molecula 2022-12-14 17:53:17 -06:00 committed by Joe Friedrich
parent f42a33640a
commit bb2c805cac

View file

@ -170,12 +170,14 @@ func (p *ExecutionPlanner) compileColumn(col *parser.ColumnDefinition) (*createT
unit := c.Expr.(*parser.StringLit)
timeUnit = unit.Value
epochString := c.EpochExpr.(*parser.StringLit)
tm, err := time.ParseInLocation(time.RFC3339, epochString.Value, time.UTC)
if err != nil {
return nil, sql3.NewErrInvalidTimeEpoch(c.EpochExpr.Pos().Line, c.EpochExpr.Pos().Line, epochString.Value)
if c.EpochExpr != nil {
epochString := c.EpochExpr.(*parser.StringLit)
tm, err := time.ParseInLocation(time.RFC3339, epochString.Value, time.UTC)
if err != nil {
return nil, sql3.NewErrInvalidTimeEpoch(c.EpochExpr.Pos().Line, c.EpochExpr.Pos().Line, epochString.Value)
}
epoch = tm
}
epoch = tm
case *parser.TimeQuantumConstraint:
unit := c.Expr.(*parser.StringLit)