Logging the table we are working on at info level

This commit is contained in:
Daniele Varrazzo 2013-04-17 17:48:05 +01:00
parent 5773c75b58
commit 08a8c943e5
3 changed files with 18 additions and 0 deletions

View File

@ -115,9 +115,14 @@ SELECT * FROM tbl_with_dropped_toast;
-- do repack -- do repack
-- --
\! pg_repack --dbname=contrib_regression --table=tbl_badindex \! pg_repack --dbname=contrib_regression --table=tbl_badindex
INFO: repacking table "tbl_badindex"
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n) WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
\! pg_repack --dbname=contrib_regression \! pg_repack --dbname=contrib_regression
INFO: repacking table "tbl_cluster"
INFO: repacking table "tbl_with_dropped_column"
INFO: repacking table "tbl_with_dropped_toast"
\! pg_repack --dbname=contrib_regression --table=tbl_cluster \! pg_repack --dbname=contrib_regression --table=tbl_cluster
INFO: repacking table "tbl_cluster"
-- --
-- after -- after
-- --
@ -308,8 +313,10 @@ WARNING: relation "tbl_nn" must have a primary key or not-null unique keys
WARNING: relation "tbl_uk" must have a primary key or not-null unique keys WARNING: relation "tbl_uk" must have a primary key or not-null unique keys
-- => WARNING -- => WARNING
\! pg_repack --dbname=contrib_regression --table=tbl_nn_uk \! pg_repack --dbname=contrib_regression --table=tbl_nn_uk
INFO: repacking table "tbl_nn_uk"
-- => OK -- => OK
\! pg_repack --dbname=contrib_regression --table=tbl_pk_uk \! pg_repack --dbname=contrib_regression --table=tbl_pk_uk
INFO: repacking table "tbl_pk_uk"
-- => OK -- => OK
\! pg_repack --dbname=contrib_regression --table=tbl_nn_puk \! pg_repack --dbname=contrib_regression --table=tbl_nn_puk
WARNING: relation "tbl_nn_puk" must have a primary key or not-null unique keys 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::
(1 row) (1 row)
\! pg_repack --dbname=contrib_regression --table=issue3_1 \! pg_repack --dbname=contrib_regression --table=issue3_1
INFO: repacking table "issue3_1"
CREATE TABLE issue3_2 (col1 int NOT NULL, col2 text NOT NULL); CREATE TABLE issue3_2 (col1 int NOT NULL, col2 text NOT NULL);
CREATE UNIQUE INDEX issue3_2_idx ON issue3_2 (col1 DESC, col2 text_pattern_ops); CREATE UNIQUE INDEX issue3_2_idx ON issue3_2 (col1 DESC, col2 text_pattern_ops);
SELECT repack.get_order_by('issue3_2_idx'::regclass::oid, 'issue3_2'::regclass::oid); 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::
(1 row) (1 row)
\! pg_repack --dbname=contrib_regression --table=issue3_2 \! pg_repack --dbname=contrib_regression --table=issue3_2
INFO: repacking table "issue3_2"
CREATE TABLE issue3_3 (col1 int NOT NULL, col2 text NOT NULL); CREATE TABLE issue3_3 (col1 int NOT NULL, col2 text NOT NULL);
CREATE UNIQUE INDEX issue3_3_idx ON issue3_3 (col1 DESC, col2 DESC); CREATE UNIQUE INDEX issue3_3_idx ON issue3_3 (col1 DESC, col2 DESC);
SELECT repack.get_order_by('issue3_3_idx'::regclass::oid, 'issue3_3'::regclass::oid); 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::
(1 row) (1 row)
\! pg_repack --dbname=contrib_regression --table=issue3_3 \! pg_repack --dbname=contrib_regression --table=issue3_3
INFO: repacking table "issue3_3"
CREATE TABLE issue3_4 (col1 int NOT NULL, col2 text NOT NULL); CREATE TABLE issue3_4 (col1 int NOT NULL, col2 text NOT NULL);
CREATE UNIQUE INDEX issue3_4_idx ON issue3_4 (col1 NULLS FIRST, col2 text_pattern_ops DESC NULLS LAST); CREATE UNIQUE INDEX issue3_4_idx ON issue3_4 (col1 NULLS FIRST, col2 text_pattern_ops DESC NULLS LAST);
SELECT repack.get_order_by('issue3_4_idx'::regclass::oid, 'issue3_4'::regclass::oid); 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::
(1 row) (1 row)
\! pg_repack --dbname=contrib_regression --table=issue3_4 \! pg_repack --dbname=contrib_regression --table=issue3_4
INFO: repacking table "issue3_4"
CREATE TABLE issue3_5 (col1 int NOT NULL, col2 text NOT NULL); CREATE TABLE issue3_5 (col1 int NOT NULL, col2 text NOT NULL);
CREATE UNIQUE INDEX issue3_5_idx ON issue3_5 (col1 DESC NULLS FIRST, col2 COLLATE "POSIX" DESC); CREATE UNIQUE INDEX issue3_5_idx ON issue3_5 (col1 DESC NULLS FIRST, col2 COLLATE "POSIX" DESC);
SELECT repack.get_order_by('issue3_5_idx'::regclass::oid, 'issue3_5'::regclass::oid); 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::
(1 row) (1 row)
\! pg_repack --dbname=contrib_regression --table=issue3_5 \! pg_repack --dbname=contrib_regression --table=issue3_5
INFO: repacking table "issue3_5"

View File

@ -18,6 +18,7 @@ INSERT INTO testts1 (data) values ('b');
INSERT INTO testts1 (data) values ('c'); INSERT INTO testts1 (data) values ('c');
-- can move the tablespace from default -- can move the tablespace from default
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 --tablespace testts \! pg_repack --dbname=contrib_regression --no-order --table=testts1 --tablespace testts
INFO: repacking table "testts1"
SELECT relname, spcname SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1' WHERE relname ~ '^testts1'
@ -37,6 +38,7 @@ SELECT * from testts1 order by id;
-- tablespace stays where it is -- tablespace stays where it is
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 \! pg_repack --dbname=contrib_regression --no-order --table=testts1
INFO: repacking table "testts1"
SELECT relname, spcname SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1' WHERE relname ~ '^testts1'
@ -48,6 +50,7 @@ ORDER BY relname;
-- can move the ts back to default -- can move the ts back to default
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 -s pg_default \! pg_repack --dbname=contrib_regression --no-order --table=testts1 -s pg_default
INFO: repacking table "testts1"
SELECT relname, spcname SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1' WHERE relname ~ '^testts1'
@ -58,6 +61,7 @@ ORDER BY relname;
-- can move the table together with the indexes -- can move the table together with the indexes
\! pg_repack --dbname=contrib_regression --no-order --table=testts1 --tablespace testts --moveidx \! pg_repack --dbname=contrib_regression --no-order --table=testts1 --tablespace testts --moveidx
INFO: repacking table "testts1"
SELECT relname, spcname SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1' WHERE relname ~ '^testts1'

View File

@ -918,6 +918,8 @@ repack_one_table(const repack_table *table, const char *orderby)
initStringInfo(&sql); initStringInfo(&sql);
elog(INFO, "repacking table \"%s\"", table->target_name);
elog(DEBUG2, "---- repack_one_table ----"); elog(DEBUG2, "---- repack_one_table ----");
elog(DEBUG2, "target_name : %s", table->target_name); elog(DEBUG2, "target_name : %s", table->target_name);
elog(DEBUG2, "target_oid : %u", table->target_oid); elog(DEBUG2, "target_oid : %u", table->target_oid);