diff options
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/tablecmds.c | 12 | ||||
-rw-r--r-- | src/backend/commands/tablespace.c | 2 |
2 files changed, 5 insertions, 9 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 1b8e6d57294..7d8a75d23c2 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -14375,14 +14375,10 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace, LOCKMODE lockmode) } /* - * Generate a new relfilenumber. We cannot reuse the old relfilenumber - * because of the possibility that that relation will be moved back to the - * original tablespace before the next checkpoint. At that point, the - * first segment of the main fork won't have been unlinked yet, and an - * attempt to create new relation storage with that same relfilenumber - * will fail. - */ - newrelfilenumber = GetNewRelFileNumber(newTableSpace, + * Relfilenumbers are not unique in databases across tablespaces, so we + * need to allocate a new one in the new tablespace. + */ + newrelfilenumber = GetNewRelFileNumber(newTableSpace, NULL, rel->rd_rel->relpersistence); /* Open old and new relation */ diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index cdd7986dfc3..b69ff37dbbd 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -267,7 +267,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) * parts. */ if (strlen(location) + 1 + strlen(TABLESPACE_VERSION_DIRECTORY) + 1 + - OIDCHARS + 1 + RELNUMBERCHARS + 1 + FORKNAMECHARS + 1 + OIDCHARS > MAXPGPATH) + OIDCHARS + 1 + OIDCHARS + 1 + FORKNAMECHARS + 1 + OIDCHARS > MAXPGPATH) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("tablespace location \"%s\" is too long", |