pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Read include/exclude commands for dump/restore from file
2+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2023-11-30 17935e1fdf  Fix array subscript warnings
* pgsql: Read include/exclude commands for dump/restore from file
@ 2023-11-29 14:21 Daniel Gustafsson <dgustafsson@postgresql.org>
  2023-11-30 05:43 ` Re: pgsql: Read include/exclude commands for dump/restore from file Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 2+ messages in thread

From: Daniel Gustafsson @ 2023-11-29 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Read include/exclude commands for dump/restore from file

When there is a need to filter multiple tables with include and/or exclude
options it's quite possible to run into the limitations of the commandline.
This adds a --filter=FILENAME feature to pg_dump, pg_dumpall and pg_restore
which is used to supply a file containing object exclude/include commands
which work just like their commandline counterparts. The format of the file
is one command per row like:

    <command> <object> <objectpattern>

<command> can be "include" or "exclude", <object> can be table_data, index
table_data_and_children, database, extension, foreign_data, function, table
schema, table_and_children or trigger.

This patch has gone through many revisions and design changes over a long
period of time, the list of reviewers reflect reviewers of some version of
the patch, not necessarily the final version.

Patch by Pavel Stehule with some additional hacking by me.

Author: Pavel Stehule <pavel.stehule@gmail.com>
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Reviewed-by: Erik Rijkers <er@xs4all.nl>
Discussion: https://postgr.es/m/CAFj8pRB10wvW0CC9Xq=1XDs=zCQxer3cbLcNZa+qiX4cUH-G_A@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a5cf808be55bcc68c3917c380f95122436af1be1

Modified Files
--------------
doc/src/sgml/ref/pg_dump.sgml               | 117 ++++
doc/src/sgml/ref/pg_dumpall.sgml            |  31 ++
doc/src/sgml/ref/pg_restore.sgml            |  80 +++
src/bin/pg_dump/Makefile                    |   5 +-
src/bin/pg_dump/filter.c                    | 471 ++++++++++++++++
src/bin/pg_dump/filter.h                    |  71 +++
src/bin/pg_dump/meson.build                 |   2 +
src/bin/pg_dump/pg_dump.c                   | 118 ++++
src/bin/pg_dump/pg_dumpall.c                |  67 +++
src/bin/pg_dump/pg_restore.c                | 109 ++++
src/bin/pg_dump/t/005_pg_dump_filterfile.pl | 799 ++++++++++++++++++++++++++++
src/tools/msvc/Mkvcbuild.pm                 |   1 +
src/tools/pgindent/typedefs.list            |   3 +
13 files changed, 1872 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: Read include/exclude commands for dump/restore from file
  2023-11-29 14:21 pgsql: Read include/exclude commands for dump/restore from file Daniel Gustafsson <dgustafsson@postgresql.org>
@ 2023-11-30 05:43 ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2023-11-30 05:43 UTC (permalink / raw)
  To: Daniel Gustafsson <dgustafsson@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

Hi Daniel,

On Wed, Nov 29, 2023 at 02:21:28PM +0000, Daniel Gustafsson wrote:
> Read include/exclude commands for dump/restore from file
> 
> When there is a need to filter multiple tables with include and/or exclude
> options it's quite possible to run into the limitations of the commandline.
> This adds a --filter=FILENAME feature to pg_dump, pg_dumpall and pg_restore
> which is used to supply a file containing object exclude/include commands
> which work just like their commandline counterparts. The format of the file
> is one command per row like:
> 
>     <command> <object> <objectpattern>
> 
> <command> can be "include" or "exclude", <object> can be table_data, index
> table_data_and_children, database, extension, foreign_data, function, table
> schema, table_and_children or trigger.
> 
> This patch has gone through many revisions and design changes over a long
> period of time, the list of reviewers reflect reviewers of some version of
> the patch, not necessarily the final version.

mamba is unhappy with the new filter.c:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=mamba&dt=2023-11-30%2002%3A53%3A25

For instance:
filter.c: In function 'filter_get_keyword':
filter.c:188:17: error: array subscript has type 'char' [-Werror=char-subscripts]
188 |  while (isspace(*ptr))
    |                 ^
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2023-11-30 05:43 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29 14:21 pgsql: Read include/exclude commands for dump/restore from file Daniel Gustafsson <dgustafsson@postgresql.org>
2023-11-30 05:43 ` Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox