--table=table
- Dump only tables (or views or sequences or foreign tables) matching
- table . Multiple tables
+ Dump only tables with names matching
+ table .
+ For this purpose, table> includes views, materialized views,
+ sequences, and foreign tables. Multiple tables
can be selected by writing multiple -t> switches. Also, the
table parameter is
interpreted as a pattern according to the same rules used by
--table=table
- Restore definition and/or data of named table only. Multiple tables
- may be specified with multiple -t> switches. This can be
- combined with the -n option to specify a schema.
-
+ Restore definition and/or data of only the named table.
+ For this purpose, table> includes views, materialized views,
+ sequences, and foreign tables. Multiple tables
+ can be selected by writing multiple -t> switches.
+ This option can be combined with the -n option to
+ specify table(s) in a particular schema.
+
+
+
+ When
-t is specified,
pg_restore>
+ makes no attempt to restore any other database objects that the
+ selected table(s) might depend upon. Therefore, there is no
+ guarantee that a specific-table restore into a clean database will
+ succeed.
+
+
+
+
+ This flag does not behave identically to the -t
+ flag of
pg_dump . There is not currently
+ any provision for wild-card matching in
pg_restore>,
+ nor can you include a schema name within its -t>.
+
+
+
+
+ In versions prior to
PostgreSQL> 9.6, this flag
+ matched only tables, not any other type of relation.
+
+
fail if the user does not have the right to insert the rows from the
dump into the table.
-
+
Note that this option currently also requires the dump be in INSERT
format as COPY TO does not support row security.
if (ropt->selTypes)
{
if (strcmp(te->desc, "TABLE") == 0 ||
- strcmp(te->desc, "TABLE DATA") == 0)
+ strcmp(te->desc, "TABLE DATA") == 0 ||
+ strcmp(te->desc, "VIEW") == 0 ||
+ strcmp(te->desc, "FOREIGN TABLE") == 0 ||
+ strcmp(te->desc, "MATERIALIZED VIEW") == 0 ||
+ strcmp(te->desc, "MATERIALIZED VIEW DATA") == 0 ||
+ strcmp(te->desc, "SEQUENCE") == 0 ||
+ strcmp(te->desc, "SEQUENCE SET") == 0)
{
if (!ropt->selTable)
return 0;
if (strlen(optarg) != 0)
opts->superuser = pg_strdup(optarg);
break;
- case 't': /* Dump data for this table only */
+ case 't': /* Dump specified table(s) only */
opts->selTypes = 1;
opts->selTable = 1;
simple_string_list_append(&opts->tableNames, optarg);
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, --table=NAME restore named relation (table, view, etc) \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"));