From 1c9f9e888fc2d86446f445d768ff076b1643e167 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas <heikki.linnakangas@iki.fi> Date: Tue, 24 Jun 2014 12:31:36 +0300 Subject: [PATCH] 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. --- src/backend/commands/tablecmds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 6136e546a19..288757aa508 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -550,7 +550,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); /* -- GitLab