multiple_tables.v5.diff
application/octet-stream
Filename: multiple_tables.v5.diff
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
Series: patch v5
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/clusterdb.sgml | 13 | 0 |
| doc/src/sgml/ref/pg_restore.sgml | 2 | 1 |
| doc/src/sgml/ref/reindexdb.sgml | 25 | 0 |
| doc/src/sgml/ref/vacuumdb.sgml | 13 | 0 |
| src/bin/pg_dump/common.c | 0 | 0 |
| src/bin/pg_dump/dumputils.c | 33 | 1 |
| src/bin/pg_dump/dumputils.h | 17 | 0 |
| src/bin/pg_dump/pg_backup_archiver.c | 1 | 0 |
| src/bin/pg_dump/pg_backup.h | 2 | 1 |
| src/bin/pg_dump/pg_dump.h | 0 | 0 |
| src/bin/pg_dump/pg_restore.c | 2 | 0 |
| src/bin/scripts/clusterdb.c | 20 | 0 |
| src/bin/scripts/Makefile | 1 | 0 |
| src/bin/scripts/reindexdb.c | 34 | 0 |
| src/bin/scripts/vacuumdb.c | 24 | 0 |
*** a/doc/src/sgml/ref/clusterdb.sgml
--- b/doc/src/sgml/ref/clusterdb.sgml
***************
*** 24,30 **** PostgreSQL documentation
<command>clusterdb</command>
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
<group choice="opt"><arg choice="plain"><option>--verbose</option></arg><arg choice="plain"><option>-v</option></arg></group>
! <arg choice="opt"><group choice="plain"><arg choice="plain"><option>--table</option></arg><arg choice="plain"><option>-t</option></arg></group> <replaceable>table</replaceable> </arg>
<arg choice="opt"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
--- 24,40 ----
<command>clusterdb</command>
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
<group choice="opt"><arg choice="plain"><option>--verbose</option></arg><arg choice="plain"><option>-v</option></arg></group>
!
! <arg choice="plain" rep="repeat">
! <arg choice="opt">
! <group choice="plain">
! <arg choice="plain"><option>--table</option></arg>
! <arg choice="plain"><option>-t</option></arg>
! </group>
! <replaceable>table</replaceable>
! </arg>
! </arg>
!
<arg choice="opt"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
***************
*** 117,122 **** PostgreSQL documentation
--- 127,134 ----
<listitem>
<para>
Cluster <replaceable class="parameter">table</replaceable> only.
+ Multiple tables can be clustered by writing multiple
+ <option>-t</> switches.
</para>
</listitem>
</varlistentry>
*** a/doc/src/sgml/ref/pg_restore.sgml
--- b/doc/src/sgml/ref/pg_restore.sgml
***************
*** 400,406 ****
<term><option>--table=<replaceable class="parameter">table</replaceable></option></term>
<listitem>
<para>
! Restore definition and/or data of named table only. This can be
combined with the <option>-n</option> option to specify a schema.
</para>
</listitem>
--- 400,407 ----
<term><option>--table=<replaceable class="parameter">table</replaceable></option></term>
<listitem>
<para>
! Restore definition and/or data of named table only. Multiple tables
! may be specified with multiple <option>-t</> switches. This can be
combined with the <option>-n</option> option to specify a schema.
</para>
</listitem>
*** a/doc/src/sgml/ref/reindexdb.sgml
--- b/doc/src/sgml/ref/reindexdb.sgml
***************
*** 23,42 **** PostgreSQL documentation
<cmdsynopsis>
<command>reindexdb</command>
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
! <group choice="opt">
! <group choice="plain">
! <arg choice="plain"><option>--table</option></arg>
! <arg choice="plain"><option>-t</option></arg>
! </group>
! <replaceable>table</replaceable>
! </group>
! <group choice="opt">
! <group choice="plain">
! <arg choice="plain"><option>--index</option></arg>
! <arg choice="plain"><option>-i</option></arg>
! </group>
! <replaceable>index</replaceable>
! </group>
<arg choice="opt"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
--- 23,49 ----
<cmdsynopsis>
<command>reindexdb</command>
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
!
! <arg choice="plain" rep="repeat">
! <arg choice="opt">
! <group choice="plain">
! <arg choice="plain"><option>--table</option></arg>
! <arg choice="plain"><option>-t</option></arg>
! </group>
! <replaceable>table</replaceable>
! </arg>
! </arg>
!
! <arg choice="plain" rep="repeat">
! <arg choice="opt">
! <group choice="plain">
! <arg choice="plain"><option>--index</option></arg>
! <arg choice="plain"><option>-i</option></arg>
! </group>
! <replaceable>index</replaceable>
! </arg>
! </arg>
!
<arg choice="opt"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
***************
*** 128,133 **** PostgreSQL documentation
--- 135,142 ----
<listitem>
<para>
Recreate <replaceable class="parameter">index</replaceable> only.
+ Multiple indexes can be recreated by writing multiple
+ <option>-i</> switches.
</para>
</listitem>
</varlistentry>
***************
*** 158,163 **** PostgreSQL documentation
--- 167,174 ----
<listitem>
<para>
Reindex <replaceable class="parameter">table</replaceable> only.
+ Multiple tables can be reindexed by writing multiple
+ <option>-t</> switches.
</para>
</listitem>
</varlistentry>
*** a/doc/src/sgml/ref/vacuumdb.sgml
--- b/doc/src/sgml/ref/vacuumdb.sgml
***************
*** 24,37 **** PostgreSQL documentation
<command>vacuumdb</command>
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
<arg rep="repeat"><replaceable>option</replaceable></arg>
! <arg choice="opt">
! <group choice="plain">
! <arg choice="plain"><option>--table</option></arg>
! <arg choice="plain"><option>-t</option></arg>
! </group>
! <replaceable>table</replaceable>
! <arg choice="opt">( <replaceable class="parameter">column</replaceable> [,...] )</arg>
</arg>
<arg choice="opt"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
--- 24,41 ----
<command>vacuumdb</command>
<arg rep="repeat"><replaceable>connection-option</replaceable></arg>
<arg rep="repeat"><replaceable>option</replaceable></arg>
!
! <arg choice="plain" rep="repeat">
! <arg choice="opt">
! <group choice="plain">
! <arg choice="plain"><option>--table</option></arg>
! <arg choice="plain"><option>-t</option></arg>
! </group>
! <replaceable>table</replaceable>
! <arg choice="opt">( <replaceable class="parameter">column</replaceable> [,...] )</arg>
! </arg>
</arg>
+
<arg choice="opt"><replaceable>dbname</replaceable></arg>
</cmdsynopsis>
***************
*** 147,152 **** PostgreSQL documentation
--- 151,158 ----
Clean or analyze <replaceable class="parameter">table</replaceable> only.
Column names can be specified only in conjunction with
the <option>--analyze</option> or <option>--analyze-only</option> options.
+ Multiple tables can be vacuumed by writing multiple
+ <option>-t</> switches.
</para>
<tip>
<para>
*** a/src/bin/pg_dump/common.c
--- b/src/bin/pg_dump/common.c
***************
*** 898,921 **** simple_oid_list_append(SimpleOidList *list, Oid val)
list->tail = cell;
}
- void
- simple_string_list_append(SimpleStringList *list, const char *val)
- {
- SimpleStringListCell *cell;
-
- /* this calculation correctly accounts for the null trailing byte */
- cell = (SimpleStringListCell *)
- pg_malloc(sizeof(SimpleStringListCell) + strlen(val));
- cell->next = NULL;
- strcpy(cell->val, val);
-
- if (list->tail)
- list->tail->next = cell;
- else
- list->head = cell;
- list->tail = cell;
- }
-
bool
simple_oid_list_member(SimpleOidList *list, Oid val)
{
--- 898,903 ----
***************
*** 928,943 **** simple_oid_list_member(SimpleOidList *list, Oid val)
}
return false;
}
-
- bool
- simple_string_list_member(SimpleStringList *list, const char *val)
- {
- SimpleStringListCell *cell;
-
- for (cell = list->head; cell; cell = cell->next)
- {
- if (strcmp(cell->val, val) == 0)
- return true;
- }
- return false;
- }
--- 910,912 ----
*** a/src/bin/pg_dump/dumputils.c
--- b/src/bin/pg_dump/dumputils.c
***************
*** 17,23 ****
#include <ctype.h>
#include "dumputils.h"
!
#include "parser/keywords.h"
--- 17,23 ----
#include <ctype.h>
#include "dumputils.h"
! #include "dumpmem.h"
#include "parser/keywords.h"
***************
*** 1352,1354 **** exit_nicely(int code)
--- 1352,1386 ----
exit(code);
}
+
+ void
+ simple_string_list_append(SimpleStringList *list, const char *val)
+ {
+ SimpleStringListCell *cell;
+
+ /* this calculation correctly accounts for the null trailing byte */
+ cell = (SimpleStringListCell *)
+ pg_malloc(sizeof(SimpleStringListCell) + strlen(val));
+
+ cell->next = NULL;
+ strcpy(cell->val, val);
+
+ if (list->tail)
+ list->tail->next = cell;
+ else
+ list->head = cell;
+ list->tail = cell;
+ }
+
+ bool
+ simple_string_list_member(SimpleStringList *list, const char *val)
+ {
+ SimpleStringListCell *cell;
+
+ for (cell = list->head; cell; cell = cell->next)
+ {
+ if (strcmp(cell->val, val) == 0)
+ return true;
+ }
+ return false;
+ }
*** a/src/bin/pg_dump/dumputils.h
--- b/src/bin/pg_dump/dumputils.h
***************
*** 27,32 **** typedef enum /* bits returned by set_dump_section */
--- 27,45 ----
DUMP_UNSECTIONED = 0xff
} DumpSections;
+ typedef struct SimpleStringListCell
+ {
+ struct SimpleStringListCell *next;
+ char val[1]; /* VARIABLE LENGTH FIELD */
+ } SimpleStringListCell;
+
+ typedef struct SimpleStringList
+ {
+ SimpleStringListCell *head;
+ SimpleStringListCell *tail;
+ } SimpleStringList;
+
+
typedef void (*on_exit_nicely_callback) (int code, void *arg);
extern int quote_all_identifiers;
***************
*** 75,78 **** __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3), noreturn));
--- 88,95 ----
extern void on_exit_nicely(on_exit_nicely_callback function, void *arg);
extern void exit_nicely(int code) __attribute__((noreturn));
+ extern void simple_string_list_append(SimpleStringList *list, const char *val);
+ extern bool simple_string_list_member(SimpleStringList *list, const char *val);
+
+
#endif /* DUMPUTILS_H */
*** a/src/bin/pg_dump/pg_backup.h
--- b/src/bin/pg_dump/pg_backup.h
***************
*** 26,32 ****
#include "postgres_fe.h"
#include "pg_dump.h"
!
#include "libpq-fe.h"
--- 26,32 ----
#include "postgres_fe.h"
#include "pg_dump.h"
! #include "dumputils.h"
#include "libpq-fe.h"
***************
*** 125,133 **** typedef struct _restoreOptions
int selTable;
char *indexNames;
char *functionNames;
- char *tableNames;
char *schemaNames;
char *triggerNames;
int useDB;
char *dbname;
--- 125,133 ----
int selTable;
char *indexNames;
char *functionNames;
char *schemaNames;
char *triggerNames;
+ SimpleStringList tableNames;
int useDB;
char *dbname;
*** a/src/bin/pg_dump/pg_backup_archiver.c
--- b/src/bin/pg_dump/pg_backup_archiver.c
***************
*** 2493,2499 **** _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt)
{
if (!ropt->selTable)
return 0;
! if (ropt->tableNames && strcmp(ropt->tableNames, te->tag) != 0)
return 0;
}
else if (strcmp(te->desc, "INDEX") == 0)
--- 2493,2499 ----
{
if (!ropt->selTable)
return 0;
! if (ropt->tableNames.head != NULL && (!(simple_string_list_member(&ropt->tableNames, te->tag))))
return 0;
}
else if (strcmp(te->desc, "INDEX") == 0)
*** a/src/bin/pg_dump/pg_dump.h
--- b/src/bin/pg_dump/pg_dump.h
***************
*** 58,74 **** typedef struct SimpleOidList
SimpleOidListCell *tail;
} SimpleOidList;
- typedef struct SimpleStringListCell
- {
- struct SimpleStringListCell *next;
- char val[1]; /* VARIABLE LENGTH FIELD */
- } SimpleStringListCell;
-
- typedef struct SimpleStringList
- {
- SimpleStringListCell *head;
- SimpleStringListCell *tail;
- } SimpleStringList;
/*
* The data structures used to store system catalog information. Every
--- 58,63 ----
***************
*** 533,541 **** extern CollInfo *findCollationByOid(Oid oid);
extern NamespaceInfo *findNamespaceByOid(Oid oid);
extern void simple_oid_list_append(SimpleOidList *list, Oid val);
- extern void simple_string_list_append(SimpleStringList *list, const char *val);
extern bool simple_oid_list_member(SimpleOidList *list, Oid val);
- extern bool simple_string_list_member(SimpleStringList *list, const char *val);
extern void parseOidArray(const char *str, Oid *array, int arraysize);
--- 522,528 ----
*** a/src/bin/pg_dump/pg_restore.c
--- b/src/bin/pg_dump/pg_restore.c
***************
*** 234,240 **** main(int argc, char **argv)
case 't': /* Dump data for this table only */
opts->selTypes = 1;
opts->selTable = 1;
! opts->tableNames = pg_strdup(optarg);
break;
case 'U':
--- 234,240 ----
case 't': /* Dump data for this table only */
opts->selTypes = 1;
opts->selTable = 1;
! simple_string_list_append(&opts->tableNames, optarg);
break;
case 'U':
***************
*** 424,430 **** usage(const char *progname)
printf(_(" -P, --function=NAME(args) restore named function\n"));
printf(_(" -s, --schema-only restore only the schema, no data\n"));
printf(_(" -S, --superuser=NAME superuser user name to use for disabling triggers\n"));
! printf(_(" -t, --table=NAME restore named table\n"));
printf(_(" -T, --trigger=NAME restore named trigger\n"));
printf(_(" -x, --no-privileges skip restoration of access privileges (grant/revoke)\n"));
printf(_(" -1, --single-transaction restore as a single transaction\n"));
--- 424,430 ----
printf(_(" -P, --function=NAME(args) restore named function\n"));
printf(_(" -s, --schema-only restore only the schema, no data\n"));
printf(_(" -S, --superuser=NAME superuser user name to use for disabling triggers\n"));
! printf(_(" -t, --table=NAME restore named table(s)\n"));
printf(_(" -T, --trigger=NAME restore named trigger\n"));
printf(_(" -x, --no-privileges skip restoration of access privileges (grant/revoke)\n"));
printf(_(" -1, --single-transaction restore as a single transaction\n"));
*** a/src/bin/scripts/Makefile
--- b/src/bin/scripts/Makefile
***************
*** 32,38 **** dropdb: dropdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq
droplang: droplang.o common.o print.o mbprint.o | submake-libpq
dropuser: dropuser.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq
clusterdb: clusterdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq
! vacuumdb: vacuumdb.o common.o | submake-libpq
reindexdb: reindexdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq
dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/%
--- 32,38 ----
droplang: droplang.o common.o print.o mbprint.o | submake-libpq
dropuser: dropuser.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq
clusterdb: clusterdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq
! vacuumdb: vacuumdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq
reindexdb: reindexdb.o common.o dumputils.o kwlookup.o keywords.o | submake-libpq
dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/%
*** a/src/bin/scripts/clusterdb.c
--- b/src/bin/scripts/clusterdb.c
***************
*** 58,65 **** main(int argc, char *argv[])
bool echo = false;
bool quiet = false;
bool alldb = false;
- char *table = NULL;
bool verbose = false;
progname = get_progname(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
--- 58,65 ----
bool echo = false;
bool quiet = false;
bool alldb = false;
bool verbose = false;
+ SimpleStringList tables = {NULL, NULL};
progname = get_progname(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
***************
*** 98,104 **** main(int argc, char *argv[])
alldb = true;
break;
case 't':
! table = pg_strdup(optarg);
break;
case 'v':
verbose = true;
--- 98,104 ----
alldb = true;
break;
case 't':
! simple_string_list_append(&tables, optarg);
break;
case 'v':
verbose = true;
***************
*** 140,148 **** main(int argc, char *argv[])
progname);
exit(1);
}
! if (table)
{
! fprintf(stderr, _("%s: cannot cluster a specific table in all databases\n"),
progname);
exit(1);
}
--- 140,149 ----
progname);
exit(1);
}
!
! if (tables.head != NULL)
{
! fprintf(stderr, _("%s: cannot cluster specific table(s) in all databases\n"),
progname);
exit(1);
}
***************
*** 162,170 **** main(int argc, char *argv[])
dbname = get_user_name(progname);
}
! cluster_one_database(dbname, verbose, table,
! host, port, username, prompt_password,
! progname, echo);
}
exit(0);
--- 163,182 ----
dbname = get_user_name(progname);
}
! if (tables.head != NULL)
! {
! SimpleStringListCell *cell;
! for (cell = tables.head; cell; cell = cell->next)
! {
! cluster_one_database(dbname, verbose, cell->val,
! host, port, username, prompt_password,
! progname, echo);
! }
! }
! else
! cluster_one_database(dbname, verbose, NULL,
! host, port, username, prompt_password,
! progname, echo);
}
exit(0);
***************
*** 253,259 **** help(const char *progname)
printf(_(" -d, --dbname=DBNAME database to cluster\n"));
printf(_(" -e, --echo show the commands being sent to the server\n"));
printf(_(" -q, --quiet don't write any messages\n"));
! printf(_(" -t, --table=TABLE cluster specific table only\n"));
printf(_(" -v, --verbose write a lot of output\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
--- 265,271 ----
printf(_(" -d, --dbname=DBNAME database to cluster\n"));
printf(_(" -e, --echo show the commands being sent to the server\n"));
printf(_(" -q, --quiet don't write any messages\n"));
! printf(_(" -t, --table=TABLE cluster specific table(s) only\n"));
printf(_(" -v, --verbose write a lot of output\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
*** a/src/bin/scripts/reindexdb.c
--- b/src/bin/scripts/reindexdb.c
***************
*** 64,71 **** main(int argc, char *argv[])
bool alldb = false;
bool echo = false;
bool quiet = false;
! const char *table = NULL;
! const char *index = NULL;
progname = get_progname(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
--- 64,71 ----
bool alldb = false;
bool echo = false;
bool quiet = false;
! SimpleStringList indexes = {NULL, NULL};
! SimpleStringList tables = {NULL, NULL};
progname = get_progname(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
***************
*** 108,117 **** main(int argc, char *argv[])
syscatalog = true;
break;
case 't':
! table = pg_strdup(optarg);
break;
case 'i':
! index = pg_strdup(optarg);
break;
case 2:
maintenance_db = pg_strdup(optarg);
--- 108,117 ----
syscatalog = true;
break;
case 't':
! simple_string_list_append(&tables, optarg);
break;
case 'i':
! simple_string_list_append(&indexes, optarg);
break;
case 2:
maintenance_db = pg_strdup(optarg);
***************
*** 154,167 **** main(int argc, char *argv[])
fprintf(stderr, _("%s: cannot reindex all databases and system catalogs at the same time\n"), progname);
exit(1);
}
! if (table)
{
! fprintf(stderr, _("%s: cannot reindex a specific table in all databases\n"), progname);
exit(1);
}
! if (index)
{
! fprintf(stderr, _("%s: cannot reindex a specific index in all databases\n"), progname);
exit(1);
}
--- 154,167 ----
fprintf(stderr, _("%s: cannot reindex all databases and system catalogs at the same time\n"), progname);
exit(1);
}
! if (tables.head != NULL)
{
! fprintf(stderr, _("%s: cannot reindex specific table(s) in all databases\n"), progname);
exit(1);
}
! if (indexes.head != NULL)
{
! fprintf(stderr, _("%s: cannot reindex specific index(es) in all databases\n"), progname);
exit(1);
}
***************
*** 170,183 **** main(int argc, char *argv[])
}
else if (syscatalog)
{
! if (table)
{
! fprintf(stderr, _("%s: cannot reindex a specific table and system catalogs at the same time\n"), progname);
exit(1);
}
! if (index)
{
! fprintf(stderr, _("%s: cannot reindex a specific index and system catalogs at the same time\n"), progname);
exit(1);
}
--- 170,183 ----
}
else if (syscatalog)
{
! if (tables.head != NULL)
{
! fprintf(stderr, _("%s: cannot reindex specific table(s) and system catalogs at the same time\n"), progname);
exit(1);
}
! if (indexes.head != NULL)
{
! fprintf(stderr, _("%s: cannot reindex specific index(es) and system catalogs at the same time\n"), progname);
exit(1);
}
***************
*** 206,219 **** main(int argc, char *argv[])
dbname = get_user_name(progname);
}
! if (index)
! reindex_one_database(index, dbname, "INDEX", host, port,
! username, prompt_password, progname, echo);
! if (table)
! reindex_one_database(table, dbname, "TABLE", host, port,
! username, prompt_password, progname, echo);
! /* reindex database only if index or table is not specified */
! if (index == NULL && table == NULL)
reindex_one_database(dbname, dbname, "DATABASE", host, port,
username, prompt_password, progname, echo);
}
--- 206,231 ----
dbname = get_user_name(progname);
}
! if (indexes.head != NULL)
! {
! SimpleStringListCell *cell;
! for (cell = indexes.head; cell; cell = cell->next)
! {
! reindex_one_database(cell->val, dbname, "INDEX", host, port,
! username, prompt_password, progname, echo);
! }
! }
! if (tables.head != NULL)
! {
! SimpleStringListCell *cell;
! for (cell = tables.head; cell; cell = cell->next)
! {
! reindex_one_database(cell->val, dbname, "TABLE", host, port,
! username, prompt_password, progname, echo);
! }
! }
! /* reindex database only if neither index nor table is specified */
! if (indexes.head == NULL && tables.head == NULL)
reindex_one_database(dbname, dbname, "DATABASE", host, port,
username, prompt_password, progname, echo);
}
***************
*** 331,340 **** help(const char *progname)
printf(_(" -a, --all reindex all databases\n"));
printf(_(" -d, --dbname=DBNAME database to reindex\n"));
printf(_(" -e, --echo show the commands being sent to the server\n"));
! printf(_(" -i, --index=INDEX recreate specific index only\n"));
printf(_(" -q, --quiet don't write any messages\n"));
printf(_(" -s, --system reindex system catalogs\n"));
! printf(_(" -t, --table=TABLE reindex specific table only\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\nConnection options:\n"));
--- 343,352 ----
printf(_(" -a, --all reindex all databases\n"));
printf(_(" -d, --dbname=DBNAME database to reindex\n"));
printf(_(" -e, --echo show the commands being sent to the server\n"));
! printf(_(" -i, --index=INDEX recreate specific index(es) only\n"));
printf(_(" -q, --quiet don't write any messages\n"));
printf(_(" -s, --system reindex system catalogs\n"));
! printf(_(" -t, --table=TABLE reindex specific table(s) only\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\nConnection options:\n"));
*** a/src/bin/scripts/vacuumdb.c
--- b/src/bin/scripts/vacuumdb.c
***************
*** 12,17 ****
--- 12,18 ----
#include "postgres_fe.h"
#include "common.h"
+ #include "dumputils.h"
static void vacuum_one_database(const char *dbname, bool full, bool verbose,
***************
*** 68,76 **** main(int argc, char *argv[])
bool analyze_only = false;
bool freeze = false;
bool alldb = false;
- char *table = NULL;
bool full = false;
bool verbose = false;
progname = get_progname(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
--- 69,77 ----
bool analyze_only = false;
bool freeze = false;
bool alldb = false;
bool full = false;
bool verbose = false;
+ SimpleStringList tables = {NULL, NULL};
progname = get_progname(argv[0]);
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pgscripts"));
***************
*** 118,124 **** main(int argc, char *argv[])
alldb = true;
break;
case 't':
! table = pg_strdup(optarg);
break;
case 'f':
full = true;
--- 119,125 ----
alldb = true;
break;
case 't':
! simple_string_list_append(&tables, optarg);
break;
case 'f':
full = true;
***************
*** 181,189 **** main(int argc, char *argv[])
progname);
exit(1);
}
! if (table)
{
! fprintf(stderr, _("%s: cannot vacuum a specific table in all databases\n"),
progname);
exit(1);
}
--- 182,190 ----
progname);
exit(1);
}
! if (tables.head != NULL)
{
! fprintf(stderr, _("%s: cannot vacuum specific table(s) in all databases\n"),
progname);
exit(1);
}
***************
*** 204,213 **** main(int argc, char *argv[])
dbname = get_user_name(progname);
}
! vacuum_one_database(dbname, full, verbose, and_analyze, analyze_only,
! freeze, table,
! host, port, username, prompt_password,
! progname, echo);
}
exit(0);
--- 205,228 ----
dbname = get_user_name(progname);
}
! if (tables.head != NULL)
! {
! SimpleStringListCell *cell;
! for (cell = tables.head; cell; cell = cell->next)
! {
! vacuum_one_database(dbname, full, verbose, and_analyze,
! analyze_only,
! freeze, cell->val,
! host, port, username, prompt_password,
! progname, echo);
! }
! }
! else
! vacuum_one_database(dbname, full, verbose, and_analyze,
! analyze_only,
! freeze, NULL,
! host, port, username, prompt_password,
! progname, echo);
}
exit(0);
***************
*** 348,354 **** help(const char *progname)
printf(_(" -f, --full do full vacuuming\n"));
printf(_(" -F, --freeze freeze row transaction information\n"));
printf(_(" -q, --quiet don't write any messages\n"));
! printf(_(" -t, --table='TABLE[(COLUMNS)]' vacuum specific table only\n"));
printf(_(" -v, --verbose write a lot of output\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -z, --analyze update optimizer statistics\n"));
--- 363,369 ----
printf(_(" -f, --full do full vacuuming\n"));
printf(_(" -F, --freeze freeze row transaction information\n"));
printf(_(" -q, --quiet don't write any messages\n"));
! printf(_(" -t, --table='TABLE[(COLUMNS)]' vacuum specific table(s) only\n"));
printf(_(" -v, --verbose write a lot of output\n"));
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -z, --analyze update optimizer statistics\n"));