summaryrefslogtreecommitdiff
path: root/src/bin/scripts/vacuumdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/scripts/vacuumdb.c')
-rw-r--r--src/bin/scripts/vacuumdb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index d3fa51cf1fa..e2b187eab3a 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -16,6 +16,8 @@
#include <sys/select.h>
#endif
+#include "catalog/pg_class.h"
+
#include "common.h"
#include "fe_utils/simple_list.h"
#include "fe_utils/string_utils.h"
@@ -388,8 +390,12 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts,
initPQExpBuffer(&buf);
res = executeQuery(conn,
- "SELECT c.relname, ns.nspname FROM pg_class c, pg_namespace ns\n"
- " WHERE relkind IN (\'r\', \'m\') AND c.relnamespace = ns.oid\n"
+ "SELECT c.relname, ns.nspname"
+ " FROM pg_class c, pg_namespace ns\n"
+ " WHERE relkind IN ("
+ CppAsString2(RELKIND_RELATION) ", "
+ CppAsString2(RELKIND_MATVIEW) ")"
+ " AND c.relnamespace = ns.oid\n"
" ORDER BY c.relpages DESC;",
progname, echo);