Re: Allowing REINDEX to have an optional name

Justin Pryzby <pryzby@telsasoft.com>

From: Justin Pryzby <pryzby@telsasoft.com>
To: Simon Riggs <simon.riggs@enterprisedb.com>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, pgsql-hackers@postgresql.org
Date: 2022-06-28T00:18:07Z
Lists: pgsql-hackers
Maybe the answer is to 1) add a parenthesized option REINDEX(SYSTEM) (to allow
the current behavior); and 2) make REINDEX DATABASE an alias which implies
"SYSTEM false"; 3) prohibit REINDEX (SYSTEM true) SYSTEM, or consider removing
"REINDEX SYSTEM;".

That avoids the opaque and surprising behavior that "REINDEX DATABASE" skips
system stuff but "REINDEX DATABASE foo" doesn't, while allowing the old
behavior (disabled by default).



Commits

  1. Tweak a bit the new TAP tests of REINDEX DATABASE/SYSTEM

  2. Rework logic and simplify syntax of REINDEX DATABASE/SYSTEM

  3. Add more tests for REINDEX DATABASE/SYSTEM with relfilenode changes