Skip to content

Commit

Permalink
sql: refactor unimplemented statements into one file pkg/sql/unimplem…
Browse files Browse the repository at this point in the history
…ented.go

Moved files with unimplemented stubs into just 1 file unimplemented.go.
These unimplemented stubs work in DSC only and we will not implement
them on the legacy schema changer.

Fixes: #45671
Release note: none
  • Loading branch information
Bergin Dedej committed Dec 19, 2024
1 parent b181396 commit 613db3e
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 129 deletions.
6 changes: 1 addition & 5 deletions pkg/sql/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ go_library(
"alter_function.go",
"alter_index.go",
"alter_index_visible.go",
"alter_policy.go",
"alter_primary_key.go",
"alter_role.go",
"alter_schema.go",
Expand Down Expand Up @@ -41,7 +40,6 @@ go_library(
"comment_on_index.go",
"comment_on_schema.go",
"comment_on_table.go",
"comment_on_type.go",
"compact_sql_stats.go",
"completions.go",
"conn_executor.go",
Expand All @@ -64,7 +62,6 @@ go_library(
"create_external_connection.go",
"create_function.go",
"create_index.go",
"create_policy.go",
"create_role.go",
"create_schema.go",
"create_sequence.go",
Expand Down Expand Up @@ -103,13 +100,11 @@ go_library(
"drop_function.go",
"drop_index.go",
"drop_owned_by.go",
"drop_policy.go",
"drop_role.go",
"drop_schema.go",
"drop_sequence.go",
"drop_table.go",
"drop_tenant.go",
"drop_trigger.go",
"drop_type.go",
"drop_view.go",
"error_hints.go",
Expand Down Expand Up @@ -279,6 +274,7 @@ go_library(
"txn_state.go",
"type_change.go",
"unary.go",
"unimplemented.go",
"union.go",
"unlisten.go",
"unsplit.go",
Expand Down
19 changes: 0 additions & 19 deletions pkg/sql/alter_policy.go

This file was deleted.

20 changes: 0 additions & 20 deletions pkg/sql/comment_on_type.go

This file was deleted.

19 changes: 0 additions & 19 deletions pkg/sql/create_policy.go

This file was deleted.

27 changes: 0 additions & 27 deletions pkg/sql/drop_owned_by.go

This file was deleted.

19 changes: 0 additions & 19 deletions pkg/sql/drop_policy.go

This file was deleted.

20 changes: 0 additions & 20 deletions pkg/sql/drop_trigger.go

This file was deleted.

55 changes: 55 additions & 0 deletions pkg/sql/unimplemented.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2024 The Cockroach Authors.
//
// Use of this software is governed by the CockroachDB Software License
// included in the /LICENSE file.

package sql

import (
"context"

"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
"github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgerror"
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
)

// The below methods are ordered in alphabetical order. They represent statements
// which are UNIMPLEMENTED for the legacy schema changer.

func (p *planner) AlterPolicy(ctx context.Context, n *tree.AlterPolicy) (planNode, error) {
return nil, pgerror.New(pgcode.FeatureNotSupported,
"ALTER POLICY is only implemented in the declarative schema changer")
}

func (p *planner) CommentOnType(ctx context.Context, n *tree.CommentOnType) (planNode, error) {
return nil, pgerror.New(pgcode.FeatureNotSupported,
"COMMENT ON TYPE is only implemented in the declarative schema changer")
}

func (p *planner) CreatePolicy(ctx context.Context, n *tree.CreatePolicy) (planNode, error) {
return nil, pgerror.New(pgcode.FeatureNotSupported,
"CREATE POLICY is only implemented in the declarative schema changer")
}

func (p *planner) DropOwnedBy(ctx context.Context) (planNode, error) {
if err := checkSchemaChangeEnabled(
ctx,
p.ExecCfg(),
"DROP OWNED BY",
); err != nil {
return nil, err
}

return nil, pgerror.New(pgcode.FeatureNotSupported,
"DROP OWNED BY is only implemented in the declarative schema changer")
}

func (p *planner) DropPolicy(ctx context.Context, n *tree.DropPolicy) (planNode, error) {
return nil, pgerror.New(pgcode.FeatureNotSupported,
"DROP POLICY is only implemented in the declarative schema changer")
}

func (p *planner) DropTrigger(_ context.Context, _ *tree.DropTrigger) (planNode, error) {
return nil, pgerror.New(pgcode.FeatureNotSupported,
"DROP TRIGGER is only implemented in the declarative schema changer")
}

0 comments on commit 613db3e

Please sign in to comment.