diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index f97bee5..6ab7556 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -5914,6 +5914,16 @@ ATExecAddIndex(AlteredTableInfo *tab, Relation rel,
 	check_rights = !is_rebuild;
 	/* skip index build if phase 3 will do it or we're reusing an old one */
 	skip_build = tab->rewrite > 0 || OidIsValid(stmt->oldNode);
+	/* keep track of original tablespace if we're reusing old index */
+	if (tab->rewrite == 0 && OidIsValid(stmt->oldNode))
+	{
+		Oid	tablespaceid = get_rel_tablespace(stmt->oldNode);
+
+		if (tablespaceid == InvalidOid)
+			tablespaceid = MyDatabaseTableSpace;
+
+			stmt->tableSpace = get_tablespace_name(tablespaceid);
+	}
 	/* suppress notices when rebuilding existing index */
 	quiet = is_rebuild;
 
