[doc] clarify behaviour of pg_dump's -t/--table option with non-tables

Started by Ian Lawrence Barwickalmost 6 years ago5 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t43047
psql -h localhost -U postgres

Built from patchset v2 (message #2), July 27, 2026 at 06:27 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t43047_2 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t43047_2 && git checkout t43047_2

Patchset v2 (message #2) is on t43047_2

Jump to latest
#1Ian Lawrence Barwick
barwick@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]https://www.postgresql.org/docs/current/app-pgdump.html
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

Regards

Ian Barwick

--
EnterpriseDB: https://www.enterprisedb.com

Attachments:

doc-pg_dump-clarify-table-option.patchtext/x-patch; charset=US-ASCII; name=doc-pg_dump-clarify-table-option.patchDownload+9-3
#2Ian Lawrence Barwick
barwick@gmail.com
In reply to: Ian Lawrence Barwick (#1)
Re: [doc] clarify behaviour of pg_dump's -t/--table option with non-tables

2020年10月6日(火) 21:58 Ian Lawrence Barwick <barwick@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

Attachments:

t43047_2
doc-pg_dump-clarify-table-option.v2.patchtext/x-patch; charset=US-ASCII; name=doc-pg_dump-clarify-table-option.v2.patchDownload+9-3
#3Magnus Hagander
magnus@hagander.net
In reply to: Ian Lawrence Barwick (#1)
Re: [doc] clarify behaviour of pg_dump's -t/--table option with non-tables

On Tue, Oct 6, 2020 at 2:59 PM Ian Lawrence Barwick <barwick@gmail.com>
wrote:

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.

LGTM and agreed on the backpatch. Pushed.

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

#4Magnus Hagander
magnus@hagander.net
In reply to: Ian Lawrence Barwick (#2)
Re: [doc] clarify behaviour of pg_dump's -t/--table option with non-tables

On Tue, Oct 6, 2020 at 3:45 PM Ian Lawrence Barwick <barwick@gmail.com>
wrote:

2020年10月6日(火) 21:58 Ian Lawrence Barwick <barwick@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.

Argh, perfect timing. I'll update with your new version :)

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

#5Ian Lawrence Barwick
barwick@gmail.com
In reply to: Magnus Hagander (#4)
Re: [doc] clarify behaviour of pg_dump's -t/--table option with non-tables

2020年10月6日(火) 22:48 Magnus Hagander <magnus@hagander.net>:

On Tue, Oct 6, 2020 at 3:45 PM Ian Lawrence Barwick <barwick@gmail.com> wrote:

2020年10月6日(火) 21:58 Ian Lawrence Barwick <barwick@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.

Argh, perfect timing. I'll update with your new version :)

Whoops, wasn't expecting such a quick response. Thanks!

FWIW, I sent in another patch suggesting removal of an ancient
backwards compatibility
"Note" under the same -t/--tables option description [1]/messages/by-id/CAB8KJ=jYHgnxLLZSNJz7gBTck4TxomngCmGkw3nEMSNF0yL6wA@mail.gmail.com.

[1]: /messages/by-id/CAB8KJ=jYHgnxLLZSNJz7gBTck4TxomngCmGkw3nEMSNF0yL6wA@mail.gmail.com

Regards

Ian Barwick

--
EnterpriseDB: https://www.enterprisedb.com