Skip to content

Commit 08a8c94

Browse files
committed
Logging the table we are working on at info level
1 parent 5773c75 commit 08a8c94

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

bin/expected/repack.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,14 @@ SELECT * FROM tbl_with_dropped_toast;
115115
-- do repack
116116
--
117117
\! pg_repack --dbname=contrib_regression --table=tbl_badindex
118+
INFO: repacking table "tbl_badindex"
118119
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
119120
\! pg_repack --dbname=contrib_regression
121+
INFO: repacking table "tbl_cluster"
122+
INFO: repacking table "tbl_with_dropped_column"
123+
INFO: repacking table "tbl_with_dropped_toast"
120124
\! pg_repack --dbname=contrib_regression --table=tbl_cluster
125+
INFO: repacking table "tbl_cluster"
121126
--
122127
-- after
123128
--
@@ -308,8 +313,10 @@ WARNING: relation "tbl_nn" must have a primary key or not-null unique keys
308313
WARNING: relation "tbl_uk" must have a primary key or not-null unique keys
309314
-- => WARNING
310315
\! pg_repack --dbname=contrib_regression --table=tbl_nn_uk
316+
INFO: repacking table "tbl_nn_uk"
311317
-- => OK
312318
\! pg_repack --dbname=contrib_regression --table=tbl_pk_uk
319+
INFO: repacking table "tbl_pk_uk"
313320
-- => OK
314321
\! pg_repack --dbname=contrib_regression --table=tbl_nn_puk
315322
WARNING: relation "tbl_nn_puk" must have a primary key or not-null unique keys
@@ -326,6 +333,7 @@ SELECT repack.get_order_by('issue3_1_idx'::regclass::oid, 'issue3_1'::regclass::
326333
(1 row)
327334

328335
\! pg_repack --dbname=contrib_regression --table=issue3_1
336+
INFO: repacking table "issue3_1"
329337
CREATE TABLE issue3_2 (col1 int NOT NULL, col2 text NOT NULL);
330338
CREATE UNIQUE INDEX issue3_2_idx ON issue3_2 (col1 DESC, col2 text_pattern_ops);
331339
SELECT repack.get_order_by('issue3_2_idx'::regclass::oid, 'issue3_2'::regclass::oid);
@@ -335,6 +343,7 @@ SELECT repack.get_order_by('issue3_2_idx'::regclass::oid, 'issue3_2'::regclass::
335343
(1 row)
336344

337345
\! pg_repack --dbname=contrib_regression --table=issue3_2
346+
INFO: repacking table "issue3_2"
338347
CREATE TABLE issue3_3 (col1 int NOT NULL, col2 text NOT NULL);
339348
CREATE UNIQUE INDEX issue3_3_idx ON issue3_3 (col1 DESC, col2 DESC);
340349
SELECT repack.get_order_by('issue3_3_idx'::regclass::oid, 'issue3_3'::regclass::oid);
@@ -344,6 +353,7 @@ SELECT repack.get_order_by('issue3_3_idx'::regclass::oid, 'issue3_3'::regclass::
344353
(1 row)
345354

346355
\! pg_repack --dbname=contrib_regression --table=issue3_3
356+
INFO: repacking table "issue3_3"
347357
CREATE TABLE issue3_4 (col1 int NOT NULL, col2 text NOT NULL);
348358
CREATE UNIQUE INDEX issue3_4_idx ON issue3_4 (col1 NULLS FIRST, col2 text_pattern_ops DESC NULLS LAST);
349359
SELECT repack.get_order_by('issue3_4_idx'::regclass::oid, 'issue3_4'::regclass::oid);
@@ -353,6 +363,7 @@ SELECT repack.get_order_by('issue3_4_idx'::regclass::oid, 'issue3_4'::regclass::
353363
(1 row)
354364

355365
\! pg_repack --dbname=contrib_regression --table=issue3_4
366+
INFO: repacking table "issue3_4"
356367
CREATE TABLE issue3_5 (col1 int NOT NULL, col2 text NOT NULL);
357368
CREATE UNIQUE INDEX issue3_5_idx ON issue3_5 (col1 DESC NULLS FIRST, col2 COLLATE "POSIX" DESC);
358369
SELECT repack.get_order_by('issue3_5_idx'::regclass::oid, 'issue3_5'::regclass::oid);
@@ -362,3 +373,4 @@ SELECT repack.get_order_by('issue3_5_idx'::regclass::oid, 'issue3_5'::regclass::
362373
(1 row)
363374

364375
\! pg_repack --dbname=contrib_regression --table=issue3_5
376+
INFO: repacking table "issue3_5"

bin/expected/tablespace.out

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ INSERT INTO testts1 (data) values ('b');
1818
INSERT INTO testts1 (data) values ('c');
1919
-- can move the tablespace from default
2020
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 --tablespace testts
21+
INFO: repacking table "testts1"
2122
SELECT relname, spcname
2223
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
2324
WHERE relname ~ '^testts1'
@@ -37,6 +38,7 @@ SELECT * from testts1 order by id;
3738

3839
-- tablespace stays where it is
3940
\! pg_repack --dbname=contrib_regression --no-order --table=testts1
41+
INFO: repacking table "testts1"
4042
SELECT relname, spcname
4143
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
4244
WHERE relname ~ '^testts1'
@@ -48,6 +50,7 @@ ORDER BY relname;
4850

4951
-- can move the ts back to default
5052
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 -s pg_default
53+
INFO: repacking table "testts1"
5154
SELECT relname, spcname
5255
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
5356
WHERE relname ~ '^testts1'
@@ -58,6 +61,7 @@ ORDER BY relname;
5861

5962
-- can move the table together with the indexes
6063
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 --tablespace testts --moveidx
64+
INFO: repacking table "testts1"
6165
SELECT relname, spcname
6266
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
6367
WHERE relname ~ '^testts1'

bin/pg_repack.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,8 @@ repack_one_table(const repack_table *table, const char *orderby)
918918

919919
initStringInfo(&sql);
920920

921+
elog(INFO, "repacking table \"%s\"", table->target_name);
922+
921923
elog(DEBUG2, "---- repack_one_table ----");
922924
elog(DEBUG2, "target_name : %s", table->target_name);
923925
elog(DEBUG2, "target_oid : %u", table->target_oid);

0 commit comments

Comments
 (0)