[postgis-devel] [PATCH] using external TOC in postgis_restore.pl
Christoph Moench-Tegeder
cmt at burggraben.net
Sun May 15 08:15:05 PDT 2016
Hi,
while upgrading a cusotmer's PostGIS installation, $SUBJECT was
found to be very helpful - filtering in pg_dump is much less
powerful than editing the dump's TOC and feeding that into
postgis_restore.
Attached patch adds the -L option (analogous to pg_restore) to
postgis_restore.pl, which makes postgis_restore use the provided
TOC instead of reading it via pg_restore -l.
It's rather trivial, so without further ado: here it is.
Regards,
Christoph
--
Spare Space
-------------- next part --------------
Index: utils/postgis_restore.pl.in
===================================================================
--- utils/postgis_restore.pl.in (revision 14902)
+++ utils/postgis_restore.pl.in (working copy)
@@ -52,6 +52,7 @@
my $DEBUG = 0;
my $POSTGIS_SCHEMA;
+my $POSTGIS_TOC;
# NOTE: the SRID limits here are being discussed:
# http://lists.osgeo.org/pipermail/postgis-devel/2012-February/018440.html
@@ -66,6 +67,9 @@
elsif ( $arg eq '-s' ) {
$POSTGIS_SCHEMA = shift(@ARGV);
}
+ elsif ( $arg eq '-L' ) {
+ $POSTGIS_TOC = shift(@ARGV);
+ }
elsif ( $arg eq '--' ) {
last;
}
@@ -106,9 +110,13 @@
# are part of PostGIS
#
-print STDERR " Writing manifest of things to read from dump file...\n";
+if(!defined($POSTGIS_TOC)) {
+ print STDERR " Writing manifest of things to read from dump file...\n";
-open( DUMP, "pg_restore -l $dumpfile |" ) || die "$me:\tCannot open dump file '$dumpfile'\n";
+ open( DUMP, "pg_restore -l $dumpfile |" ) || die "$me:\tCannot open dump file '$dumpfile'\n";
+} else {
+ open( DUMP, '<' . $POSTGIS_TOC) || die "$me:\tCannot open TOC file '$POSTGIS_TOC'\n";
+}
open( MANIFEST, ">$manifest" ) || die "$me:\tCannot open manifest file '$manifest'\n";
while( my $l = <DUMP> ) {
More information about the postgis-devel
mailing list