Skip to content

Commit 4c0c2f3

Browse files
committed
restore the warning message about invalid indexes, to match old behavior and pass installcheck.
1 parent 4235735 commit 4c0c2f3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

bin/pg_repack.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,13 +603,27 @@ rebuild_indexes(const repack_table *table)
603603
int num_indexes;
604604
int i;
605605
int num_active_workers = 0;
606-
repack_index *index_jobs;
606+
repack_index *index_jobs;
607607
char buffer[12];
608608
bool have_error = false;
609609

610610
elog(DEBUG2, "---- create indexes ----");
611611

612612
params[0] = utoa(table->target_oid, buffer);
613+
614+
/* First, just display a warning message for any invalid indexes
615+
* which may be on the table (mostly to match the behavior of 1.1.8).
616+
*/
617+
res = execute("SELECT pg_get_indexdef(indexrelid)"
618+
" FROM pg_index WHERE indrelid = $1 AND NOT indisvalid",
619+
1, params);
620+
for (i = 0; i < PQntuples(res); i++)
621+
{
622+
const char *indexdef;
623+
indexdef = getstr(res, i, 0);
624+
elog(WARNING, "skipping invalid index: %s", indexdef);
625+
}
626+
613627
res = execute("SELECT indexrelid,"
614628
" repack.repack_indexdef(indexrelid, indrelid), "
615629
" pg_get_indexdef(indexrelid)"

0 commit comments

Comments
 (0)