mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
* fb-1940 re-implemented some changes that got missed private-public * fb-1939 fixes to between + decimals * fb-1935 - avg() on and id type + fixed some tests * fb-1953 add min/max for string types * fb-1938 - remove internal_type column from show columns * fb-1964 - fix space_used in fb_cluster_nodes to be int * fb-1996 - make sure all Idents that are being used as object references to schema objects are lowercased * fixed failing test * added some missed changes * fb-1969 found another case issue with identifier used for column idents
41 lines
1.3 KiB
Go
41 lines
1.3 KiB
Go
// Copyright 2021 Molecula Corp. All rights reserved.
|
|
|
|
package planner
|
|
|
|
import (
|
|
"context"
|
|
"strings"
|
|
|
|
"github.com/featurebasedb/featurebase/v3/dax"
|
|
"github.com/featurebasedb/featurebase/v3/sql3"
|
|
"github.com/featurebasedb/featurebase/v3/sql3/parser"
|
|
"github.com/featurebasedb/featurebase/v3/sql3/planner/types"
|
|
)
|
|
|
|
// compileAlterDatabaseStatement compiles an ALTER DATABASE statement into a
|
|
// PlanOperator.
|
|
func (p *ExecutionPlanner) compileAlterDatabaseStatement(ctx context.Context, stmt *parser.AlterDatabaseStatement) (_ types.PlanOperator, err error) {
|
|
databaseName := strings.ToLower(parser.IdentName(stmt.Name))
|
|
|
|
// does the database exist
|
|
dbname := dax.DatabaseName(databaseName)
|
|
db, err := p.schemaAPI.DatabaseByName(ctx, dbname)
|
|
if err != nil {
|
|
if isDatabaseNotFoundError(err) {
|
|
return nil, sql3.NewErrDatabaseNotFound(stmt.Name.NamePos.Line, stmt.Name.NamePos.Column, databaseName)
|
|
}
|
|
return nil, err
|
|
}
|
|
|
|
if stmt.With.IsValid() {
|
|
return NewPlanOpQuery(p, NewPlanOpAlterDatabase(p, db, alterOpSet, stmt.Option), p.sql), nil
|
|
} else {
|
|
return nil, sql3.NewErrInternal("unhandled alter operation")
|
|
}
|
|
}
|
|
|
|
// analyzeAlterDatabaseStatement analyze an ALTER DATABASE statement and returns an
|
|
// error if anything is invalid.
|
|
func (p *ExecutionPlanner) analyzeAlterDatabaseStatement(stmt *parser.AlterDatabaseStatement) error {
|
|
return nil
|
|
}
|