aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2012-01-06 22:54:43 -0500
committerRobert Haas <rhaas@postgresql.org>2012-01-06 22:54:43 -0500
commitdf970a0ac8fb416b179825a135c18ad3293076af (patch)
tree259ce1a57cb033401ff4481aa35784cd2efcb8e8
parent1489e2f26a4c0318938b3085f50976512f321d84 (diff)
downloadpostgresql-df970a0ac8fb416b179825a135c18ad3293076af.tar.gz
postgresql-df970a0ac8fb416b179825a135c18ad3293076af.zip
Fix backwards logic in previous commit.
I wrote this code before committing it, but managed not to include it in the actual commit.
-rw-r--r--src/backend/commands/tablecmds.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0cd273e9c6e..c37301671e4 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -9947,11 +9947,6 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("\"%s\" is not a composite type", rv->relname)));
- if (reltype == OBJECT_FOREIGN_TABLE && relkind != RELKIND_FOREIGN_TABLE)
- ereport(ERROR,
- (errcode(ERRCODE_WRONG_OBJECT_TYPE),
- errmsg("\"%s\" is not a foreign table", rv->relname)));
-
if (reltype == OBJECT_INDEX && relkind != RELKIND_INDEX
&& !IsA(stmt, RenameStmt))
ereport(ERROR,
@@ -9968,6 +9963,12 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
errmsg("\"%s\" is a composite type", rv->relname),
errhint("Use ALTER TYPE instead.")));
+ if (reltype != OBJECT_FOREIGN_TABLE && relkind == RELKIND_FOREIGN_TABLE)
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("\"%s\" is a foreign table", rv->relname),
+ errhint("Use ALTER FOREIGN TABLE instead.")));
+
/*
* Don't allow ALTER TABLE .. SET SCHEMA on relations that can't be
* moved to a different schema, such as indexes and TOAST tables.