OSDN Git Service

Generalize concept of temporary relations to "relation persistence".
[pg-rex/syncrep.git] / src / backend / catalog / catalog.c
index 6322512..88b5c2a 100644 (file)
@@ -524,12 +524,26 @@ GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
  * created by bootstrap have preassigned OIDs, so there's no need.
  */
 Oid
-GetNewRelFileNode(Oid reltablespace, Relation pg_class, BackendId backend)
+GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence)
 {
        RelFileNodeBackend rnode;
        char       *rpath;
        int                     fd;
        bool            collides;
+       BackendId       backend;
+
+       switch (relpersistence)
+       {
+               case RELPERSISTENCE_TEMP:
+                       backend = MyBackendId;
+                       break;
+               case RELPERSISTENCE_PERMANENT:
+                       backend = InvalidBackendId;
+                       break;
+               default:
+                       elog(ERROR, "invalid relpersistence: %c", relpersistence);
+                       return InvalidOid;      /* placate compiler */
+       }
 
        /* This logic should match RelationInitPhysicalAddr */
        rnode.node.spcNode = reltablespace ? reltablespace : MyDatabaseTableSpace;