From e0c2933a767c652429ddef674622b4656fa43092 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 29 Jan 2019 11:22:03 +0900 Subject: Use catalog query to discover tables to process in vacuumdb vacuumdb would use a catalog query only when the command caller does not define a list of tables. Switching to a catalog table represents two advantages: - Relation existence check can happen before running any VACUUM or ANALYZE query. Before this change, if multiple relations are defined using --table, the utility would fail only after processing the firstly-defined ones, which may be a long some depending on the size of the relation. This adds checks for the relation names, and does nothing, at least yet, for the attribute names. - More filtering options can become available for the utility user. These options, which may be introduced later on, are based on the relation size or the relation age, and need to be made available even if the user does not list any specific table with --table. Author: Nathan Bossart Reviewed-by: Michael Paquier, Masahiko Sawada Discussion: https://postgr.es/m/FFE5373C-E26A-495B-B5C8-911EC4A41C5E@amazon.com --- src/bin/scripts/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/bin/scripts/common.c') diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c index 4215bc3d6e6..7139b7c6672 100644 --- a/src/bin/scripts/common.c +++ b/src/bin/scripts/common.c @@ -265,9 +265,9 @@ executeMaintenanceCommand(PGconn *conn, const char *query, bool echo) * finish using them, pg_free(*table). *columns is a pointer into "spec", * possibly to its NUL terminator. */ -static void -split_table_columns_spec(const char *spec, int encoding, - char **table, const char **columns) +void +splitTableColumnsSpec(const char *spec, int encoding, + char **table, const char **columns) { bool inquotes = false; const char *cp = spec; @@ -318,7 +318,7 @@ appendQualifiedRelation(PQExpBuffer buf, const char *spec, return; } - split_table_columns_spec(spec, PQclientEncoding(conn), &table, &columns); + splitTableColumnsSpec(spec, PQclientEncoding(conn), &table, &columns); /* * Query must remain ABSOLUTELY devoid of unqualified names. This would -- cgit v1.2.3