mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
* implement CREATE/ALTER/DROP VIEW * fixed failing test * another failing test * fixed some broken serverless tests
23 lines
748 B
Go
23 lines
748 B
Go
// Copyright 2023 Molecula Corp. All rights reserved.
|
|
|
|
package planner
|
|
|
|
import (
|
|
"github.com/molecula/featurebase/v3/sql3"
|
|
"github.com/molecula/featurebase/v3/sql3/parser"
|
|
"github.com/molecula/featurebase/v3/sql3/planner/types"
|
|
)
|
|
|
|
// compileDropViewStatement compiles a DROP VIEW statement into a PlanOperator.
|
|
func (p *ExecutionPlanner) compileDropViewStatement(stmt *parser.DropViewStatement) (_ types.PlanOperator, err error) {
|
|
viewName := parser.IdentName(stmt.Name)
|
|
v, err := p.getViewByName(viewName)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if v == nil && !stmt.IfExists.IsValid() {
|
|
return nil, sql3.NewErrViewNotFound(0, 0, viewName)
|
|
}
|
|
|
|
return NewPlanOpQuery(p, NewPlanOpDropView(p, stmt.IfExists.IsValid(), viewName), p.sql), nil
|
|
}
|