pg.ddx.io pgsql-admin@postgresql.org mailing list archivehelp / color / mirror / Atom feed
enhancement request for pg_restore 3+ messages / 3 participants [nested] [flat]
* enhancement request for pg_restore @ 2015-08-13 15:10 Campbell, Lance <lance@illinois.edu> 0 siblings, 1 reply; 3+ messages in thread From: Campbell, Lance @ 2015-08-13 15:10 UTC (permalink / raw) To: pgsql-admin PostgreSQL 9.4.x I love using the PostgreSQL database. It is wonderful. Please consider adding to pg_restore the command line option to exclude one or more tables similar to the pg_dump option. Example: --exclude-table=table Why? I like to restore all tables within a particular namespace from our production database to our test database. But there are many times when you have some tables that hold data you don't necessarily need information from. In those cases I would exclude those tables. I would then do a second pg_restore so I could get the schema for those particular tables. Example of how this would work: pg_restore -U someuser -h localhost -d mydatabase --schema=myschema --exclude-table=myschema.table1 --exclude-table=myschema.table2 --format=custom /my/backup/to/restore pg_restore -U someuser -h localhost -d mydatabase --schema-only -- table=myschema.table1 --table=myschema.table2 --format=custom /my/backup/to/restore Thanks for considering this enhancement to pg_restore. Lance Campbell Web Services University of Illinois -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: enhancement request for pg_restore @ 2015-08-13 15:56 Andres Freund <andres@anarazel.de> parent: Campbell, Lance <lance@illinois.edu> 0 siblings, 1 reply; 3+ messages in thread From: Andres Freund @ 2015-08-13 15:56 UTC (permalink / raw) To: Campbell, Lance <lance@illinois.edu>; +Cc: pgsql-admin Hi Lance, On 2015-08-13 15:10:21 +0000, Campbell, Lance wrote: > PostgreSQL 9.4.x > > I love using the PostgreSQL database. It is wonderful. Good to hear! > Please consider adding to pg_restore the command line option to exclude one or more tables similar to the pg_dump option. > > Example: > > --exclude-table=table > > Why? I like to restore all tables within a particular namespace from > our production database to our test database. But there are many > times when you have some tables that hold data you don't necessarily > need information from. In those cases I would exclude those tables. > I would then do a second pg_restore so I could get the schema for > those particular tables. You can kind of do this today using pg_restore's --list parameter to dump the list of objects in the archive, then remove the objects you don't need/want, and then use --use-list to restore only the remaining objects. Greetings, Andres Freund -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: enhancement request for pg_restore @ 2015-08-13 17:37 Tom Lane <tgl@sss.pgh.pa.us> parent: Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2015-08-13 17:37 UTC (permalink / raw) To: Andres Freund <andres@anarazel.de>; +Cc: Campbell, Lance <lance@illinois.edu>; pgsql-admin Andres Freund <andres@anarazel.de> writes: > On 2015-08-13 15:10:21 +0000, Campbell, Lance wrote: >> Please consider adding to pg_restore the command line option to exclude one or more tables similar to the pg_dump option. > You can kind of do this today using pg_restore's --list parameter to > dump the list of objects in the archive, then remove the objects you > don't need/want, and then use --use-list to restore only the remaining > objects. IIRC, the key reason why this is less than trivial is that pg_dump relies on the server to identify which table names match the supplied pattern(s); it basically does a "select from pg_class where relname ~ 'pattern'" kind of query. Short of porting the server's regex engine into pg_restore, it would be hard to be 100% compatible with that definition. Perhaps it's not necessary to implement wildcards in the pg_restore case, or maybe it would be Close Enough if we relied on libc regexes, but in any case it's not quite as simple as it might sound. So basically this is unlikely to happen until somebody who wants the feature bad enough spends the time to write and defend a patch. regards, tom lane -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2015-08-13 17:37 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2015-08-13 15:10 enhancement request for pg_restore Campbell, Lance <lance@illinois.edu> 2015-08-13 15:56 ` Andres Freund <andres@anarazel.de> 2015-08-13 17:37 ` Tom Lane <tgl@sss.pgh.pa.us>
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