aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/file/sharedfileset.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/file/sharedfileset.c')
-rw-r--r--src/backend/storage/file/sharedfileset.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/storage/file/sharedfileset.c b/src/backend/storage/file/sharedfileset.c
index d41b39a1771..aa634acb26e 100644
--- a/src/backend/storage/file/sharedfileset.c
+++ b/src/backend/storage/file/sharedfileset.c
@@ -61,9 +61,25 @@ SharedFileSetInit(SharedFileSet *fileset, dsm_segment *seg)
lengthof(fileset->tablespaces));
if (fileset->ntablespaces == 0)
{
- fileset->tablespaces[0] = DEFAULTTABLESPACE_OID;
+ /* If the GUC is empty, use current database's default tablespace */
+ fileset->tablespaces[0] = MyDatabaseTableSpace;
fileset->ntablespaces = 1;
}
+ else
+ {
+ int i;
+
+ /*
+ * An entry of InvalidOid means use the default tablespace for the
+ * current database. Replace that now, to be sure that all users of
+ * the SharedFileSet agree on what to do.
+ */
+ for (i = 0; i < fileset->ntablespaces; i++)
+ {
+ if (fileset->tablespaces[i] == InvalidOid)
+ fileset->tablespaces[i] = MyDatabaseTableSpace;
+ }
+ }
/* Register our cleanup callback. */
on_dsm_detach(seg, SharedFileSetOnDetach, PointerGetDatum(fileset));