aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/common.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-01-29 11:22:03 +0900
committerMichael Paquier <michael@paquier.xyz>2019-01-29 11:22:03 +0900
commite0c2933a767c652429ddef674622b4656fa43092 (patch)
treea1c4045c2703be40525f375f5f8662c53f32cecc /src/bin/scripts/common.c
parentda05eb51debd5d4b0284bcafa728244183c303ae (diff)
downloadpostgresql-e0c2933a767c652429ddef674622b4656fa43092.tar.gz
postgresql-e0c2933a767c652429ddef674622b4656fa43092.zip
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
Diffstat (limited to 'src/bin/scripts/common.c')
-rw-r--r--src/bin/scripts/common.c8
1 files changed, 4 insertions, 4 deletions
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