summaryrefslogtreecommitdiff
path: root/src/bin/scripts/vacuumdb.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-03-09 22:42:16 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2017-03-09 22:42:16 -0500
commitfcd778eb703c154c0fbba249e17c21b7ae4de19b (patch)
tree2e303735853b29f698314409403a0ae795e90f1a /src/bin/scripts/vacuumdb.c
parent15bb93e28e49fdf4f28d509c07d1527886acb3e2 (diff)
Fix hard-coded relkind constants in assorted src/bin files.
Although it's reasonable to expect that most of these constants will never change, that does not make it good programming style to hard-code the value rather than using the RELKIND_FOO macros. Discussion: https://postgr.es/m/11145.1488931324@sss.pgh.pa.us
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);