Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Env var to ignore all unsupported DDL operations / commands #1154

Merged
merged 3 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 2 additions & 3 deletions server/ast/alter_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -30,5 +28,6 @@ func nodeAlterAggregate(ctx *Context, node *tree.AlterAggregate) (vitess.Stateme
if err := validateAggArgMode(ctx, node.AggSig.Args, node.AggSig.OrderByArgs); err != nil {
return nil, err
}
return nil, errors.Errorf("ALTER AGGREGATE is not yet supported")

return NotYetSupportedError("ALTER AGGREGATE is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/alter_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeAlterDatabase(ctx *Context, node *tree.AlterDatabase) (vitess.Statement
if node == nil {
return nil, nil
}
return nil, errors.Errorf("ALTER DATABASE is not yet supported")

return NotYetSupportedError("ALTER DATABASE is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/alter_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -28,5 +26,6 @@ func nodeAlterFunction(ctx *Context, node *tree.AlterFunction) (vitess.Statement
if err != nil {
return nil, err
}
return nil, errors.Errorf("ALTER FUNCTION statement is not yet supported")

return NotYetSupportedError("ALTER FUNCTION statement is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/alter_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,6 +25,7 @@ func nodeAlterIndex(ctx *Context, node *tree.AlterIndex) (vitess.Statement, erro
if node == nil {
return nil, nil
}

// Only PARTITION alterations are supported by the parser, so there's nothing to convert to yet
return nil, errors.Errorf("ALTER INDEX is not yet supported")
return NotYetSupportedError("ALTER INDEX is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/alter_procedure.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -28,5 +26,6 @@ func nodeAlterProcedure(ctx *Context, node *tree.AlterProcedure) (vitess.Stateme
if err != nil {
return nil, err
}
return nil, errors.Errorf("ALTER PROCEDURE statement is not yet supported")

return NotYetSupportedError("ALTER PROCEDURE statement is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/alter_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeAlterSchema(ctx *Context, node *tree.AlterSchema) (vitess.Statement, er
if node == nil {
return nil, nil
}
return nil, errors.Errorf("ALTER SCHEMA is not yet supported")

return NotYetSupportedError("ALTER SCHEMA is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/alter_sequence.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeAlterSequence(ctx *Context, node *tree.AlterSequence) (vitess.Statement
if node == nil {
return nil, nil
}
return nil, errors.Errorf("ALTER SEQUENCE is not yet supported")

return NotYetSupportedError("ALTER SEQUENCE is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/alter_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeAlterType(ctx *Context, node *tree.AlterType) (vitess.Statement, error)
if node == nil {
return nil, nil
}
return nil, errors.Errorf("ALTER TYPE is not yet supported")

return NotYetSupportedError("ALTER TYPE is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeBackup(ctx *Context, node *tree.Backup) (vitess.Statement, error) {
if node == nil {
return nil, nil
}
return nil, errors.Errorf("BACKUP is not yet supported")

return NotYetSupportedError("BACKUP is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/cancel_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeCancelQueries(ctx *Context, node *tree.CancelQueries) (vitess.Statement
if node == nil {
return nil, nil
}
return nil, errors.Errorf("CANCEL QUERIES is not yet supported")

return NotYetSupportedError("CANCEL QUERIES is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/cancel_sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeCancelSessions(ctx *Context, node *tree.CancelSessions) (vitess.Stateme
if node == nil {
return nil, nil
}
return nil, errors.Errorf("CANCEL SESSIONS is not yet supported")

return NotYetSupportedError("CANCEL SESSIONS is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/canned_opt_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeCannedOptPlan(ctx *Context, node *tree.CannedOptPlan) (vitess.Statement
if node == nil {
return nil, nil
}
return nil, errors.Errorf("PREPARE AS OPT PLAN is not yet supported")

return NotYetSupportedError("PREPARE AS OPT PLAN is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeComment(ctx *Context, node *tree.Comment) (vitess.Statement, error) {
if node == nil {
return nil, nil
}
return nil, errors.Errorf("COMMENT ON is not yet supported")

return NotYetSupportedError("COMMENT ON is not yet supported")
}
8 changes: 4 additions & 4 deletions server/ast/control_jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,13 +25,15 @@ func nodeControlJobs(ctx *Context, node *tree.ControlJobs) (vitess.Statement, er
if node == nil {
return nil, nil
}
return nil, errors.Errorf("PAUSE/RESUME/CANCEL are not yet supported")

return NotYetSupportedError("PAUSE/RESUME/CANCEL are not yet supported")
}

// nodeControlJobsForSchedules handles *tree.ControlJobsForSchedules nodes.
func nodeControlJobsForSchedules(ctx *Context, node *tree.ControlJobsForSchedules) (vitess.Statement, error) {
if node == nil {
return nil, nil
}
return nil, errors.Errorf("PAUSE/RESUME/CANCEL are not yet supported")

return NotYetSupportedError("PAUSE/RESUME/CANCEL are not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/control_schedules.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeControlSchedules(ctx *Context, node *tree.ControlSchedules) (vitess.Sta
if node == nil {
return nil, nil
}
return nil, errors.Errorf("PAUSE/RESUME SCHEDULE is not yet supported")

return NotYetSupportedError("PAUSE/RESUME SCHEDULE is not yet supported")
}
10 changes: 7 additions & 3 deletions server/ast/create_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ func nodeCreateAggregate(ctx *Context, node *tree.CreateAggregate) (vitess.State
if node == nil {
return nil, nil
}
if err := validateAggArgMode(ctx, node.Args, node.OrderByArgs); err != nil {
return nil, err

if !ignoreUnsupportedStatements {
if err := validateAggArgMode(ctx, node.Args, node.OrderByArgs); err != nil {
return nil, err
}
}
return nil, errors.Errorf("CREATE AGGREGATE is not yet supported")

return NotYetSupportedError("CREATE AGGREGATE is not yet supported")
}

// validateAggArgMode checks routine arguments for `OUT` and `INOUT` modes,
Expand Down
5 changes: 2 additions & 3 deletions server/ast/create_changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeCreateChangefeed(ctx *Context, node *tree.CreateChangefeed) (vitess.Sta
if node == nil {
return nil, nil
}
return nil, errors.Errorf("CREATE CHANGEFEED is not yet supported")

return NotYetSupportedError("CREATE CHANGEFEED is not yet supported")
}
3 changes: 2 additions & 1 deletion server/ast/create_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ func nodeCreateFunction(ctx *Context, node *tree.CreateFunction) (vitess.Stateme
if err != nil {
return nil, err
}
return nil, errors.Errorf("CREATE FUNCTION statement is not yet supported")

return NotYetSupportedError("CREATE FUNCTION statement is not yet supported")
}

// verifyRedundantRoutineOption checks for each option defined only once.
Expand Down
5 changes: 2 additions & 3 deletions server/ast/create_procedure.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -28,5 +26,6 @@ func nodeCreateProcedure(ctx *Context, node *tree.CreateProcedure) (vitess.State
if err != nil {
return nil, err
}
return nil, errors.Errorf("CREATE PROCEDURE statement is not yet supported")

return NotYetSupportedError("CREATE PROCEDURE statement is not yet supported")
}
5 changes: 2 additions & 3 deletions server/ast/create_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,5 +25,6 @@ func nodeCreateStats(ctx *Context, node *tree.CreateStats) (vitess.Statement, er
if node == nil {
return nil, nil
}
return nil, errors.Errorf("CREATE STATISTICS is not yet supported")

return NotYetSupportedError("CREATE STATISTICS is not yet supported")
}
4 changes: 1 addition & 3 deletions server/ast/create_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
)

// nodeCreateTrigger handles *tree.CreateTrigger nodes.
func nodeCreateTrigger(ctx *Context, node *tree.CreateTrigger) (vitess.Statement, error) {
return nil, errors.Errorf("CREATE TRIGGER statement is not yet supported")
return NotYetSupportedError("CREATE TRIGGER statement is not yet supported")
}
14 changes: 8 additions & 6 deletions server/ast/drop_aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package ast

import (
"github.com/cockroachdb/errors"

vitess "github.com/dolthub/vitess/go/vt/sqlparser"

"github.com/dolthub/doltgresql/postgres/parser/sem/tree"
Expand All @@ -27,10 +25,14 @@ func nodeDropAggregate(ctx *Context, node *tree.DropAggregate) (vitess.Statement
if node == nil {
return nil, nil
}
for _, agg := range node.Aggregates {
if err := validateAggArgMode(ctx, agg.AggSig.Args, agg.AggSig.OrderByArgs); err != nil {
return nil, err

if !ignoreUnsupportedStatements {
for _, agg := range node.Aggregates {
if err := validateAggArgMode(ctx, agg.AggSig.Args, agg.AggSig.OrderByArgs); err != nil {
return nil, err
}
}
}
return nil, errors.Errorf("DROP AGGREGATE is not yet supported")

return NotYetSupportedError("DROP AGGREGATE is not yet supported")
}
Loading