diff --git a/bin/pg_repack.c b/bin/pg_repack.c index 14eb640..34337a6 100644 --- a/bin/pg_repack.c +++ b/bin/pg_repack.c @@ -305,6 +305,11 @@ main(int argc, char *argv[]) } else { + if (schema_list.head && table_list.head) + ereport(ERROR, + (errcode(EINVAL), + errmsg("cannot repack specific table(s) in schema, use schema.table notation instead"))); + if (noorder) orderby = ""; diff --git a/regress/expected/repack.out b/regress/expected/repack.out index 2ca7b39..e282fb5 100644 --- a/regress/expected/repack.out +++ b/regress/expected/repack.out @@ -353,22 +353,27 @@ CREATE TRIGGER zzzzzz AFTER UPDATE ON trg4 FOR EACH ROW EXECUTE PROCEDURE trgtes \! pg_repack --dbname=contrib_regression --table=trg4 INFO: repacking table "trg4" -- --- Repack single schema +-- Test --schema -- CREATE SCHEMA test_schema1; CREATE TABLE test_schema1.tbl1 (id INTEGER PRIMARY KEY); CREATE TABLE test_schema1.tbl2 (id INTEGER PRIMARY KEY); -\! pg_repack --dbname=contrib_regression --schema=test_schema1 -INFO: repacking table "test_schema1.tbl1" -INFO: repacking table "test_schema1.tbl2" --- --- Repack two schemas --- CREATE SCHEMA test_schema2; CREATE TABLE test_schema2.tbl1 (id INTEGER PRIMARY KEY); CREATE TABLE test_schema2.tbl2 (id INTEGER PRIMARY KEY); -\! pg_repack --dbname=contrib_regression --schema=test_schema1 --schema=test_schema2 -INFO: repacking table "test_schema2.tbl1" +-- => 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 diff --git a/regress/sql/repack.sql b/regress/sql/repack.sql index 875f50c..88500ea 100644 --- a/regress/sql/repack.sql +++ b/regress/sql/repack.sql @@ -208,17 +208,19 @@ CREATE TRIGGER zzzzzz AFTER UPDATE ON trg4 FOR EACH ROW EXECUTE PROCEDURE trgtes \! pg_repack --dbname=contrib_regression --table=trg4 -- --- Repack single schema +-- Test --schema -- CREATE SCHEMA test_schema1; CREATE TABLE test_schema1.tbl1 (id INTEGER PRIMARY KEY); CREATE TABLE test_schema1.tbl2 (id INTEGER PRIMARY KEY); -\! pg_repack --dbname=contrib_regression --schema=test_schema1 - --- --- Repack two schemas --- 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 +-- => OK \! pg_repack --dbname=contrib_regression --schema=test_schema1 --schema=test_schema2 +-- => ERROR +\! pg_repack --dbname=contrib_regression --schema=test_schema1 --table=tbl1 +-- => ERROR +\! pg_repack --dbname=contrib_regression --all --schema=test_schema1