Skip to content

Commit 4eb1cef

Browse files
committed
Make the 'repacking index ...' message be displayed
for indexes-only repacks (not just when in dry-run mode).
1 parent 69aa4f7 commit 4eb1cef

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

bin/pg_repack.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,7 @@ repack_table_indexes(PGresult *index_details)
16831683
"WHERE pgc.relname = 'index_%u' "
16841684
"AND nsp.nspname = $1", index);
16851685
params[0] = schema_name;
1686+
elog(INFO, "repacking index \"%s\".\"index_%u\"", schema_name, index);
16861687
res = execute(sql.data, 1, params);
16871688
if (PQresultStatus(res) != PGRES_TUPLES_OK)
16881689
{
@@ -1705,10 +1706,7 @@ repack_table_indexes(PGresult *index_details)
17051706
}
17061707

17071708
if (dryrun)
1708-
{
1709-
elog(INFO, "repacking index \"%s\".\"index_%u\"", schema_name, index);
17101709
continue;
1711-
}
17121710

17131711
params[0] = utoa(index, buffer[0]);
17141712
res = execute("SELECT repack.repack_indexdef($1, $2, $3, true)", 3,

regress/expected/repack.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ INFO: repacking table "tbl_nn_uk"
323323
\! pg_repack --dbname=contrib_regression --table=tbl_pk_uk
324324
INFO: repacking table "tbl_pk_uk"
325325
-- => OK
326+
\! pg_repack --dbname=contrib_regression --table=tbl_pk_uk --only-indexes
327+
INFO: repacking indexes of "tbl_pk_uk"
328+
-- => OK
326329
\! pg_repack --dbname=contrib_regression --table=tbl_nn_puk
327330
WARNING: relation "tbl_nn_puk" must have a primary key or not-null unique keys
328331
-- => WARNING

regress/sql/repack.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ CREATE UNIQUE INDEX tbl_nn_puk_pcol1_idx ON tbl_nn_puk(col1) WHERE col1 < 10;
185185
-- => OK
186186
\! pg_repack --dbname=contrib_regression --table=tbl_pk_uk
187187
-- => OK
188+
\! pg_repack --dbname=contrib_regression --table=tbl_pk_uk --only-indexes
189+
-- => OK
188190
\! pg_repack --dbname=contrib_regression --table=tbl_nn_puk
189191
-- => WARNING
190192

0 commit comments

Comments
 (0)