Merge in Pull Request #20 from Steeve Lennmark.

Adds support for repacking only the tables in a specified schema. This
doesn't support --only-indexes mode, but that seems alright for now.

Fix merge conflicts, and make a few tweaks along the way:
 * bump version to 1.3-dev0
 * add Beena to list of maintainers
 * documentation wordsmithing
 * fix up the INFO message printed for each index in --index or
   --only-indexes mode, so that it is only printed once per index, and
   prints the name of the original index, not that of the transient
   index_%u name.
This commit is contained in:
Josh Kupershmidt
2014-05-24 15:42:24 -04:00
7 changed files with 105 additions and 13 deletions

View File

@ -325,6 +325,8 @@ INFO: repacking table "tbl_pk_uk"
-- => OK
\! pg_repack --dbname=contrib_regression --table=tbl_pk_uk --only-indexes
INFO: repacking indexes of "tbl_pk_uk"
INFO: repacking index "public"."tbl_pk_uk_pkey"
INFO: repacking index "public"."tbl_pk_uk_col2_col1_key"
-- => OK
\! pg_repack --dbname=contrib_regression --table=tbl_nn_puk
WARNING: relation "tbl_nn_puk" must have a primary key or not-null unique keys
@ -361,3 +363,27 @@ INFO: repacking table "trg4"
\! pg_repack --dbname=contrib_regression --table=tbl_cluster --dry-run
INFO: Dry run enabled, not executing repack
INFO: repacking table "tbl_cluster"
-- Test --schema
--
CREATE SCHEMA test_schema1;
CREATE TABLE test_schema1.tbl1 (id INTEGER PRIMARY KEY);
CREATE TABLE test_schema1.tbl2 (id INTEGER PRIMARY KEY);
CREATE SCHEMA test_schema2;
CREATE TABLE test_schema2.tbl1 (id INTEGER PRIMARY KEY);
CREATE TABLE test_schema2.tbl2 (id INTEGER PRIMARY KEY);
-- => OK
\! pg_repack --dbname=contrib_regression --schema=test_schema1
INFO: repacking table "test_schema1.tbl1"
INFO: repacking table "test_schema1.tbl2"
-- => OK
\! pg_repack --dbname=contrib_regression --schema=test_schema1 --schema=test_schema2
INFO: repacking table "test_schema2.tbl1"
INFO: repacking table "test_schema2.tbl2"
INFO: repacking table "test_schema1.tbl2"
INFO: repacking table "test_schema1.tbl1"
-- => ERROR
\! pg_repack --dbname=contrib_regression --schema=test_schema1 --table=tbl1
ERROR: cannot repack specific table(s) in schema, use schema.table notation instead
-- => ERROR
\! pg_repack --dbname=contrib_regression --all --schema=test_schema1
ERROR: cannot repack specific schema(s) in all databases

View File

@ -135,6 +135,9 @@ INFO: repacking table "testts1"
--move all indexes of the table to a tablespace
\! pg_repack --dbname=contrib_regression --table=testts1 --only-indexes --tablespace=testts
INFO: repacking indexes of "testts1"
INFO: repacking index "public"."testts1_pkey"
INFO: repacking index "public"."testts1_partial_idx"
INFO: repacking index "public"."testts1_with_idx"
SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1'
@ -149,6 +152,9 @@ ORDER BY relname;
--all indexes of tablespace remain in same tablespace
\! pg_repack --dbname=contrib_regression --table=testts1 --only-indexes
INFO: repacking indexes of "testts1"
INFO: repacking index "public"."testts1_pkey"
INFO: repacking index "public"."testts1_partial_idx"
INFO: repacking index "public"."testts1_with_idx"
SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1'
@ -163,6 +169,9 @@ ORDER BY relname;
--move all indexes of the table to pg_default
\! pg_repack --dbname=contrib_regression --table=testts1 --only-indexes --tablespace=pg_default
INFO: repacking indexes of "testts1"
INFO: repacking index "public"."testts1_pkey"
INFO: repacking index "public"."testts1_partial_idx"
INFO: repacking index "public"."testts1_with_idx"
SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1'
@ -173,7 +182,7 @@ ORDER BY relname;
--move one index to a tablespace
\! pg_repack --dbname=contrib_regression --index=testts1_pkey --tablespace=testts
INFO: repacking "testts1_pkey"
INFO: repacking index "public"."testts1_pkey"
SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1'
@ -185,7 +194,7 @@ ORDER BY relname;
--index tablespace stays as is
\! pg_repack --dbname=contrib_regression --index=testts1_pkey
INFO: repacking "testts1_pkey"
INFO: repacking index "public"."testts1_pkey"
SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1'
@ -197,7 +206,7 @@ ORDER BY relname;
--move index to pg_default
\! pg_repack --dbname=contrib_regression --index=testts1_pkey --tablespace=pg_default
INFO: repacking "testts1_pkey"
INFO: repacking index "public"."testts1_pkey"
SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1'
@ -208,8 +217,8 @@ ORDER BY relname;
--using multiple --index option
\! pg_repack --dbname=contrib_regression --index=testts1_pkey --index=testts1_with_idx --tablespace=testts
INFO: repacking "testts1_pkey"
INFO: repacking "testts1_with_idx"
INFO: repacking index "public"."testts1_pkey"
INFO: repacking index "public"."testts1_with_idx"
SELECT relname, spcname
FROM pg_class JOIN pg_tablespace ts ON ts.oid = reltablespace
WHERE relname ~ '^testts1'