I have 1 trivial fix, 1 bug fix, and 1 suggestion about vacuumdb.
First, I noticed that the help message of `vacuumdb` is a bit incorrect.
`vacuumdb -?` displays the following message ``` ... -n, --schema=PATTERN vacuum tables in the specified schema(s) only -N, --exclude-schema=PATTERN do not vacuum tables in the specified schema(s)
... ``` PATTERN should be changed to SCHEMA because -n and -N options don't support pattern matching for schema names. The attached patch 0001 fixes this.
Second, when we use multiple -N options, vacuumdb runs incorrectly as shown below. ``` $ psql =# CREATE SCHEMA s1; =# CREATE SCHEMA s2; =# CREATE SCHEMA s3; =# CREATE TABLE s1.t(i int); =# CREATE TABLE s2.t(i int); =# CREATE TABLE s3.t(i int); =# ALTER SYSTEM SET log_statement TO 'all'; =# SELECT pg_reload_conf(); =# \q $ vacuumdb -N s1 -N s2 ``` We expect that tables in schemas s1 and s2 should not be vacuumed, while the others should be. However, logfile says like this. ``` LOG: statement: VACUUM (SKIP_DATABASE_STATS) pg_catalog.pg_proc; LOG: statement: VACUUM (SKIP_DATABASE_STATS) pg_catalog.pg_proc;
...
LOG: statement: VACUUM (SKIP_DATABASE_STATS) s2.t; LOG: statement: VACUUM (SKIP_DATABASE_STATS) s1.t; LOG: statement: VACUUM (ONLY_DATABASE_STATS); ``` Even specified by -N, s1.t and s2.t are vacuumed, and also the others are vacuumed twice. The attached patch 0002 fixes this.
Third, for the description of the -N option, I wonder if "vacuum all tables except in the specified schema(s)" might be clearer. The current one says nothing about tables not in the specified schema.