Skip to content

Commit 92cc21d

Browse files
committed
reindexdb: Skip reindexing temporary tables and indexes.
Reindexing temp tables or indexes of other sessions is not allowed. However, reindexdb in parallel mode previously listed them as the objects to process, leading to failures. This commit ensures reindexdb in parallel mode skips temporary tables and indexes by adding a condition based on the relpersistence column in pg_class to the object listing queries, preventing these issues. Note that this commit does not affect reindexdb when temporary tables or indexes are explicitly specified using the -t or -j options; reindexdb in that case still does not skip them and can cause an error. Back-patch to v13 where parallel mode was introduced in reindexdb. Author: Fujii Masao Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/5f37ee56-14fb-44fe-9150-9eb97e10538b@oss.nttdata.com
1 parent 159bf0f commit 92cc21d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bin/scripts/reindexdb.c

+4
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,8 @@ get_parallel_object_list(PGconn *conn, ReindexType type,
638638
" AND c.relkind IN ("
639639
CppAsString2(RELKIND_RELATION) ", "
640640
CppAsString2(RELKIND_MATVIEW) ")\n"
641+
" AND c.relpersistence != "
642+
CppAsString2(RELPERSISTENCE_TEMP) "\n"
641643
" ORDER BY c.relpages DESC;");
642644
break;
643645

@@ -660,6 +662,8 @@ get_parallel_object_list(PGconn *conn, ReindexType type,
660662
" WHERE c.relkind IN ("
661663
CppAsString2(RELKIND_RELATION) ", "
662664
CppAsString2(RELKIND_MATVIEW) ")\n"
665+
" AND c.relpersistence != "
666+
CppAsString2(RELPERSISTENCE_TEMP) "\n"
663667
" AND ns.nspname IN (");
664668

665669
for (cell = user_list->head; cell; cell = cell->next)

0 commit comments

Comments
 (0)