summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/commands/tablespace.c7
-rw-r--r--src/backend/storage/file/fd.c9
2 files changed, 13 insertions, 3 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 427d896f619..6e8f6a74d89 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -1153,6 +1153,7 @@ GetDefaultTablespace(char relpersistence)
typedef struct
{
+ /* Array of OIDs to be passed to SetTempTablespaces() */
int numSpcs;
Oid tblSpcs[FLEXIBLE_ARRAY_MEMBER];
} temp_tablespaces_extra;
@@ -1202,6 +1203,7 @@ check_temp_tablespaces(char **newval, void **extra, GucSource source)
/* Allow an empty string (signifying database default) */
if (curname[0] == '\0')
{
+ /* InvalidOid signifies database's default tablespace */
tblSpcs[numSpcs++] = InvalidOid;
continue;
}
@@ -1228,6 +1230,7 @@ check_temp_tablespaces(char **newval, void **extra, GucSource source)
*/
if (curoid == MyDatabaseTableSpace)
{
+ /* InvalidOid signifies database's default tablespace */
tblSpcs[numSpcs++] = InvalidOid;
continue;
}
@@ -1338,6 +1341,7 @@ PrepareTempTablespaces(void)
/* Allow an empty string (signifying database default) */
if (curname[0] == '\0')
{
+ /* InvalidOid signifies database's default tablespace */
tblSpcs[numSpcs++] = InvalidOid;
continue;
}
@@ -1356,7 +1360,8 @@ PrepareTempTablespaces(void)
*/
if (curoid == MyDatabaseTableSpace)
{
- tblSpcs[numSpcs++] = curoid;
+ /* InvalidOid signifies database's default tablespace */
+ tblSpcs[numSpcs++] = InvalidOid;
continue;
}
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 6d016a79e93..03d43fdada1 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -253,8 +253,10 @@ static AllocateDesc *allocatedDescs = NULL;
static long tempFileCounter = 0;
/*
- * Array of OIDs of temp tablespaces. When numTempTableSpaces is -1,
- * this has not been set in the current transaction.
+ * Array of OIDs of temp tablespaces. (Some entries may be InvalidOid,
+ * indicating that the current database's default tablespace should be used.)
+ * When numTempTableSpaces is -1, this has not been set in the current
+ * transaction.
*/
static Oid *tempTableSpaces = NULL;
static int numTempTableSpaces = -1;
@@ -2518,6 +2520,9 @@ closeAllVfds(void)
* unless this function is called again before then. It is caller's
* responsibility that the passed-in array has adequate lifespan (typically
* it'd be allocated in TopTransactionContext).
+ *
+ * Some entries of the array may be InvalidOid, indicating that the current
+ * database's default tablespace should be used.
*/
void
SetTempTablespaces(Oid *tableSpaces, int numSpaces)