summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-07-03 17:01:34 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-07-03 17:01:34 -0400
commit79ed1d99d7ce4827c566c5b2bc1cf1528e8add36 (patch)
tree792c10216afb56b766470e01374ef4031b3fad98 /src/backend/commands
parent4aa02d0729f01e6f381a2ffbf052a0d54dcbdb82 (diff)
Fix temporary tablespaces for shared filesets some more.
Commit ecd9e9f0b fixed the problem in the wrong place, causing unwanted side-effects on the behavior of GetNextTempTableSpace(). Instead, let's make SharedFileSetInit() responsible for subbing in the value of MyDatabaseTableSpace when the default tablespace is called for. The convention about what is in the tempTableSpaces[] array is evidently insufficiently documented, so try to improve that. It also looks like SharedFileSetInit() is doing the wrong thing in the case where temp_tablespaces is empty. It was hard-wiring use of the pg_default tablespace, but it seems like using MyDatabaseTableSpace is more consistent with what happens for other temp files. Back-patch the reversion of PrepareTempTablespaces()'s behavior to 9.5, as ecd9e9f0b was. The changes in SharedFileSetInit() go back to v11 where that was introduced. (Note there is net zero code change before v11 from these two patch sets, so nothing to release-note.) Magnus Hagander and Tom Lane Discussion: https://postgr.es/m/CABUevExg5YEsOvqMxrjoNvb3ApVyH+9jggWGKwTDFyFCVWczGQ@mail.gmail.com
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/tablespace.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 3105efe0403..e4cd961e3ba 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -1151,6 +1151,7 @@ GetDefaultTablespace(char relpersistence)
typedef struct
{
+ /* Array of OIDs to be passed to SetTempTablespaces() */
int numSpcs;
Oid tblSpcs[FLEXIBLE_ARRAY_MEMBER];
} temp_tablespaces_extra;
@@ -1200,6 +1201,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;
}
@@ -1226,6 +1228,7 @@ check_temp_tablespaces(char **newval, void **extra, GucSource source)
*/
if (curoid == MyDatabaseTableSpace)
{
+ /* InvalidOid signifies database's default tablespace */
tblSpcs[numSpcs++] = InvalidOid;
continue;
}
@@ -1336,6 +1339,7 @@ PrepareTempTablespaces(void)
/* Allow an empty string (signifying database default) */
if (curname[0] == '\0')
{
+ /* InvalidOid signifies database's default tablespace */
tblSpcs[numSpcs++] = InvalidOid;
continue;
}
@@ -1354,7 +1358,8 @@ PrepareTempTablespaces(void)
*/
if (curoid == MyDatabaseTableSpace)
{
- tblSpcs[numSpcs++] = curoid;
+ /* InvalidOid signifies database's default tablespace */
+ tblSpcs[numSpcs++] = InvalidOid;
continue;
}