CLUSTER ON deparser should consider schemas (#5122)

(cherry picked from commit 87a51ae552)
pull/5152/head
Önder Kalacı 2021-07-16 18:13:18 +02:00 committed by Hanefi Onaldi
parent f571abcca6
commit 106d68fd61
No known key found for this signature in database
GPG Key ID: F18CDB10BA0DFDC7
1 changed files with 3 additions and 2 deletions

View File

@ -1025,12 +1025,13 @@ pg_get_indexclusterdef_string(Oid indexRelationId)
/* check if the table is clustered on this index */ /* check if the table is clustered on this index */
if (indexForm->indisclustered) if (indexForm->indisclustered)
{ {
char *tableName = generate_relation_name(tableRelationId, NIL); char *qualifiedRelationName =
generate_qualified_relation_name(tableRelationId);
char *indexName = get_rel_name(indexRelationId); /* needs to be quoted */ char *indexName = get_rel_name(indexRelationId); /* needs to be quoted */
initStringInfo(&buffer); initStringInfo(&buffer);
appendStringInfo(&buffer, "ALTER TABLE %s CLUSTER ON %s", appendStringInfo(&buffer, "ALTER TABLE %s CLUSTER ON %s",
tableName, quote_identifier(indexName)); qualifiedRelationName, quote_identifier(indexName));
} }
ReleaseSysCache(indexTuple); ReleaseSysCache(indexTuple);