aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-06-24 12:31:36 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-06-24 13:30:41 +0300
commitdd1a5b09bf070eff699c241b6de28453924e5613 (patch)
treedb6331ae982b5850b3ef80cb0dcfec95aac52cbe
parentcbc0517c3200af091cb95c35322555f4f6782da4 (diff)
downloadpostgresql-dd1a5b09bf070eff699c241b6de28453924e5613.tar.gz
postgresql-dd1a5b09bf070eff699c241b6de28453924e5613.zip
Don't allow foreign tables with OIDs.
The syntax doesn't let you specify "WITH OIDS" for foreign tables, but it was still possible with default_with_oids=true. But the rest of the system, including pg_dump, isn't prepared to handle foreign tables with OIDs properly. Backpatch down to 9.1, where foreign tables were introduced. It's possible that there are databases out there that already have foreign tables with OIDs. There isn't much we can do about that, but at least we can prevent them from being created in the future. Patch by Etsuro Fujita, reviewed by Hadi Moshayedi.
-rw-r--r--src/backend/commands/tablecmds.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 02736eef7e9..3e2e346c724 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -517,7 +517,10 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId)
*/
descriptor = BuildDescForRelation(schema);
- localHasOids = interpretOidsOption(stmt->options);
+ if (relkind == RELKIND_FOREIGN_TABLE)
+ localHasOids = false;
+ else
+ localHasOids = interpretOidsOption(stmt->options);
descriptor->tdhasoid = (localHasOids || parentOidCount > 0);
/*