static void vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
- const char *table,
+ bool freeze, const char *table,
const char *host, const char *port,
const char *username, bool password,
const char *progname, bool echo);
-static void vacuum_all_databases(bool full, bool verbose, bool analyze,
+static void vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze,
const char *host, const char *port,
const char *username, bool password,
const char *progname, bool echo, bool quiet);
{"quiet", no_argument, NULL, 'q'},
{"dbname", required_argument, NULL, 'd'},
{"analyze", no_argument, NULL, 'z'},
+ {"freeze", no_argument, NULL, 'F'},
{"all", no_argument, NULL, 'a'},
{"table", required_argument, NULL, 't'},
{"full", no_argument, NULL, 'f'},
bool echo = false;
bool quiet = false;
bool analyze = false;
+ bool freeze = false;
bool alldb = false;
char *table = NULL;
bool full = false;
handle_help_version_opts(argc, argv, "vacuumdb", help);
- while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zat:fv", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zaFt:fv", long_options, &optindex)) != -1)
{
switch (c)
{
case 'z':
analyze = true;
break;
+ case 'F':
+ freeze = true;
+ break;
case 'a':
alldb = true;
break;
exit(1);
}
- vacuum_all_databases(full, verbose, analyze,
+ vacuum_all_databases(full, verbose, analyze, freeze,
host, port, username, password,
progname, echo, quiet);
}
dbname = get_user_name(progname);
}
- vacuum_one_database(dbname, full, verbose, analyze, table,
+ vacuum_one_database(dbname, full, verbose, analyze, freeze, table,
host, port, username, password,
progname, echo);
}
static void
vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze,
- const char *table,
+ bool freeze, const char *table,
const char *host, const char *port,
const char *username, bool password,
const char *progname, bool echo)
appendPQExpBuffer(&sql, " VERBOSE");
if (analyze)
appendPQExpBuffer(&sql, " ANALYZE");
+ if (freeze)
+ appendPQExpBuffer(&sql, " FREEZE");
if (table)
appendPQExpBuffer(&sql, " %s", table);
appendPQExpBuffer(&sql, ";\n");
static void
-vacuum_all_databases(bool full, bool verbose, bool analyze,
+vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze,
const char *host, const char *port,
const char *username, bool password,
const char *progname, bool echo, bool quiet)
fflush(stdout);
}
- vacuum_one_database(dbname, full, verbose, analyze, NULL,
+ vacuum_one_database(dbname, full, verbose, analyze, freeze, NULL,
host, port, username, password,
progname, echo);
}
printf(_(" -t, --table='TABLE[(COLUMNS)]' vacuum specific table only\n"));
printf(_(" -f, --full do full vacuuming\n"));
printf(_(" -z, --analyze update optimizer hints\n"));
+ printf(_(" -F, --freeze freeze row transaction information\n"));
printf(_(" -e, --echo show the commands being sent to the server\n"));
printf(_(" -q, --quiet don't write any messages\n"));
printf(_(" -v, --verbose write a lot of output\n"));