Skip to content

Commit c2e2589

Browse files
committed
pg_dump: Allow pg_dump to dump the statistics for foreign tables.
Commit 1fd1bd8 introduced support for dumping statistics with pg_dump and pg_dumpall, covering tables, materialized views, and indexes. However, it overlooked foreign tables, even though functions like pg_restore_relation_stats() support them. This commit fixes that oversight by allowing pg_dump and pg_dumpall to include statistics for foreign tables. Author: Fujii Masao <[email protected]> Reviewed-by: Corey Huinker <[email protected]> Reviewed-by: Nathan Bossart <[email protected]> Discussion: https://postgr.es/m/[email protected]
1 parent 9e11839 commit c2e2589

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,8 +1277,8 @@ PostgreSQL documentation
12771277
</para>
12781278
<para>
12791279
The data section contains actual table data, large-object
1280-
contents, statistics for tables and materialized views and
1281-
sequence values.
1280+
contents, sequence values, and statistics for tables,
1281+
materialized views, and foriegn tables.
12821282
Post-data items include definitions of indexes, triggers, rules,
12831283
statistics for indexes, and constraints other than validated check
12841284
constraints.
@@ -1359,7 +1359,8 @@ PostgreSQL documentation
13591359
<listitem>
13601360
<para>
13611361
Dump only the statistics, not the schema (data definitions) or data.
1362-
Statistics for tables, materialized views, and indexes are dumped.
1362+
Statistics for tables, materialized views, foreign tables,
1363+
and indexes are dumped.
13631364
</para>
13641365
</listitem>
13651366
</varlistentry>

doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,8 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
690690
<listitem>
691691
<para>
692692
Dump only the statistics, not the schema (data definitions) or data.
693-
Statistics for tables, materialized views, and indexes are dumped.
693+
Statistics for tables, materialized views, foreign tables,
694+
and indexes are dumped.
694695
</para>
695696
</listitem>
696697
</varlistentry>

src/bin/pg_dump/pg_dump.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6890,7 +6890,8 @@ getRelationStatistics(Archive *fout, DumpableObject *rel, int32 relpages,
68906890
(relkind == RELKIND_PARTITIONED_TABLE) ||
68916891
(relkind == RELKIND_INDEX) ||
68926892
(relkind == RELKIND_PARTITIONED_INDEX) ||
6893-
(relkind == RELKIND_MATVIEW))
6893+
(relkind == RELKIND_MATVIEW ||
6894+
relkind == RELKIND_FOREIGN_TABLE))
68946895
{
68956896
RelStatsInfo *info = pg_malloc0(sizeof(RelStatsInfo));
68966897
DumpableObject *dobj = &info->dobj;
@@ -6929,6 +6930,7 @@ getRelationStatistics(Archive *fout, DumpableObject *rel, int32 relpages,
69296930
case RELKIND_RELATION:
69306931
case RELKIND_PARTITIONED_TABLE:
69316932
case RELKIND_MATVIEW:
6933+
case RELKIND_FOREIGN_TABLE:
69326934
info->section = SECTION_DATA;
69336935
break;
69346936
case RELKIND_INDEX:

0 commit comments

Comments
 (0)