2020年10月6日(火) 21:58 Ian Lawrence Barwick <barw...@gmail.com>: > > Hi > > Recently I ran into a case where someone was wondering why it was not > possible to dump the contents of a view, even though the documentation [1] > seems to imply this is possible. > > Currently it says: > > Dump only tables with names matching pattern. For this purpose, "table" > includes views, materialized views, sequences, and foreign tables. > > The attached patch attempts to clarify that only definitions of those objects > will be dumped, and also mentions that dumping foreign table data requires the > --include-foreign-data option. > > I suggest backpatching any changes to Pg13 where the --include-foreign-data > option was added. > > [1] https://www.postgresql.org/docs/current/app-pgdump.html
Better version attached. Regards Ian Barwick -- EnterpriseDB: https://www.enterprisedb.com
commit 4344e620620fa82d89bc9838d389cc345a7763ea Author: Ian Barwick <barw...@gmail.com> Date: Tue Oct 6 21:40:37 2020 +0900 doc: clarify behaviour of pg_dump's -t/--table option The existing wording gives the impression it might be possible to dump the contents of views, which is not possible. Also, from PostgreSQL 13 it is possible to dump the contents of foreign tables, but this requires the --include-foreign-data option. diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index f99dc3f31e..0aa35cf0c3 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -517,9 +517,7 @@ PostgreSQL documentation <listitem> <para> Dump only tables with names matching - <replaceable class="parameter">pattern</replaceable>. - For this purpose, <quote>table</quote> includes views, materialized views, - sequences, and foreign tables. Multiple tables + <replaceable class="parameter">pattern</replaceable>. Multiple tables can be selected by writing multiple <option>-t</option> switches. The <replaceable class="parameter">pattern</replaceable> parameter is interpreted as a pattern according to the same rules used by @@ -531,6 +529,14 @@ PostgreSQL documentation <xref linkend="pg-dump-examples"/> below. </para> + <para> + As well as tables, this option can be used to dump the definition of matching + views, materialized views, foreign tables, and sequences. It will not dump the + contents of views or materialized views, and the contents of foreign tables will + only be dumped if the corresponding foreign server is specified with + <option>--include-foreign-data</option>. + </para> + <para> The <option>-n</option> and <option>-N</option> switches have no effect when <option>-t</option> is used, because tables selected by <option>-t</option> will