vacuumdb: Skip temporary tables in query to build list of relations
authorMichael Paquier <michael@paquier.xyz>
Wed, 25 Sep 2024 05:43:16 +0000 (14:43 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 25 Sep 2024 05:43:16 +0000 (14:43 +0900)
commit1ab67c9dfaadda86059f405e5746efb6ddb9fe21
tree139eead3426aa5bb8ba7ac68b82c2f2e03959ce1
parent7fdeaf5774d05245e82632e763665ff62db5598e
vacuumdb: Skip temporary tables in query to build list of relations

Running vacuumdb with a non-superuser while another user has created a
temporary table would lead to a mid-flight permission failure,
interrupting the operation.  vacuum_rel() skips temporary relations of
other backends, and it makes no sense for vacuumdb to know about these
relations, so let's switch it to ignore temporary relations entirely.

Adding a qual in the query based on relpersistence simplifies the
generation of its WHERE clause in vacuum_one_database(), per se the
removal of "has_where".

Author: VaibhaveS, Michael Paquier
Reviewed-by: Fujii Masao
Discussion: https://postgr.es/m/CAM_eQjwfAR=y3G1fGyS1U9FTmc+FyJm9amNfY2QCZBnDDbNPZg@mail.gmail.com
Backpatch-through: 12
src/bin/scripts/vacuumdb.c