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

sql: miscellaneous fixes to the CONVERT TO SCHEMA command #53564

Merged
merged 1 commit into from Sep 1, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/sql/reparent_database.go
Expand Up @@ -52,6 +52,10 @@ func (p *planner) ReparentDatabase(
clusterversion.VersionByKey(clusterversion.VersionUserDefinedSchemas))
}

if string(n.Name) == p.CurrentDatabase() {
return nil, pgerror.DangerousStatementf("CONVERT TO SCHEMA on current database")
}

db, err := p.ResolveMutableDatabaseDescriptor(ctx, string(n.Name), true /* required */)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/sem/tree/stmt.go
Expand Up @@ -596,7 +596,7 @@ func (*RenameDatabase) StatementTag() string { return "RENAME DATABASE" }
func (*ReparentDatabase) StatementType() StatementType { return DDL }

// StatementTag returns a short string identifying the type of statement.
func (*ReparentDatabase) StatementTag() string { return "TODO (rohany): Implement" }
func (*ReparentDatabase) StatementTag() string { return "CONVERT TO SCHEMA" }

// StatementType implements the Statement interface.
func (*RenameIndex) StatementType() StatementType { return DDL }
Expand Down