comments.patch

text/x-diff

Filename: comments.patch
Type: text/x-diff
Part: 0
Message: Re: behaviour change - default_tablesapce + partition table

Patch

Format: unified
File+
src/backend/commands/tablecmds.c 4 3
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index b3095bd937..2a72c1b501 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -660,8 +660,8 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
 	}
 
 	/*
-	 * Select tablespace to use.  If not specified, use default tablespace
-	 * (which may in turn default to database's default).
+	 * Select tablespace to use: an explicitly indicated one, or (in the case
+	 * of a partitioned table) the parent's, if it has one.
 	 */
 	if (stmt->tablespacename)
 	{
@@ -684,7 +684,8 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
 	else
 		tablespaceId = InvalidOid;
 
-	if (!OidIsValid(tablespaceId))	/* note no "else" */
+	/* still nothing? use the default */
+	if (!OidIsValid(tablespaceId))
 		tablespaceId = GetDefaultTablespace(stmt->relation->relpersistence,
 											partitioned);