Skip to content

Commit df970a0

Browse files
committed
Fix backwards logic in previous commit.
I wrote this code before committing it, but managed not to include it in the actual commit.
1 parent 1489e2f commit df970a0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/backend/commands/tablecmds.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9947,11 +9947,6 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
99479947
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
99489948
errmsg("\"%s\" is not a composite type", rv->relname)));
99499949

9950-
if (reltype == OBJECT_FOREIGN_TABLE && relkind != RELKIND_FOREIGN_TABLE)
9951-
ereport(ERROR,
9952-
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
9953-
errmsg("\"%s\" is not a foreign table", rv->relname)));
9954-
99559950
if (reltype == OBJECT_INDEX && relkind != RELKIND_INDEX
99569951
&& !IsA(stmt, RenameStmt))
99579952
ereport(ERROR,
@@ -9968,6 +9963,12 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
99689963
errmsg("\"%s\" is a composite type", rv->relname),
99699964
errhint("Use ALTER TYPE instead.")));
99709965

9966+
if (reltype != OBJECT_FOREIGN_TABLE && relkind == RELKIND_FOREIGN_TABLE)
9967+
ereport(ERROR,
9968+
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
9969+
errmsg("\"%s\" is a foreign table", rv->relname),
9970+
errhint("Use ALTER FOREIGN TABLE instead.")));
9971+
99719972
/*
99729973
* Don't allow ALTER TABLE .. SET SCHEMA on relations that can't be
99739974
* moved to a different schema, such as indexes and TOAST tables.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy