On 2019-Jun-06, Alvaro Herrera wrote:

> Here's my proposed patch.  I changed/expanded the tests a little bit to
> ensure more complete coverage.

Well, revise the comments a little bit.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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);
 

Reply via email to