Skip to content

Commit

Permalink
sql: Use pgerror for renaming table that doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
a-robinson committed Sep 13, 2016
1 parent 3117581 commit ed43b5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sql/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (p *planner) RenameTable(n *parser.RenameTable) (planNode, error) {
return &emptyNode{}, nil
}
// Key does not exist, but we want it to: error out.
return nil, fmt.Errorf("table %q does not exist", oldTn.String())
return nil, sqlbase.NewUndefinedTableError(oldTn.String())
}
if tableDesc.State != sqlbase.TableDescriptor_PUBLIC {
return nil, sqlbase.NewUndefinedTableError(oldTn.String())
Expand Down
4 changes: 2 additions & 2 deletions sql/testdata/rename_table
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
statement error table "foo" does not exist
statement error pgcode 42P01 table "foo" does not exist
ALTER TABLE foo RENAME TO bar

statement ok
Expand Down Expand Up @@ -27,7 +27,7 @@ kv
statement ok
ALTER TABLE kv RENAME TO new_kv

statement error table "kv" does not exist
statement error pgcode 42P01 table "kv" does not exist
SELECT * FROM kv

query II
Expand Down

0 comments on commit ed43b5d

Please sign in to comment.