Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Don't allow foreign tables with OIDs.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 24 Jun 2014 09:31:36 +0000 (12:31 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 24 Jun 2014 10:31:00 +0000 (13:31 +0300)
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

index 020f8a5d4949c4e84dff3f375989b47bf4199d45..6392aee3f6a09ad0721739d3068a1963b9b92e11 100644 (file)
@@ -561,8 +561,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId)
    descriptor = BuildDescForRelation(schema);
 
    localHasOids = interpretOidsOption(stmt->options,
-                                      (relkind == RELKIND_RELATION ||
-                                       relkind == RELKIND_FOREIGN_TABLE));
+                                      (relkind == RELKIND_RELATION));
    descriptor->tdhasoid = (localHasOids || parentOidCount > 0);
 
    /*