Commit 0a4a7fa9 authored by Sandro Santilli's avatar Sandro Santilli

Force early flushing of postgis_restore.pl output

Reduces memory usage when piping output to further processing filter.

Patch by Hugh Ranalli

Closes #4330

git-svn-id: http://svn.osgeo.org/postgis/trunk@17320 b70326c6-7e19-0410-871a-916f4a2858ee
parent c34c727f
Pipeline #51139804 passed with stage
in 25 minutes and 3 seconds
......@@ -35,6 +35,8 @@ PostGIS 3.0.0
- #4342, Move deprecated functions into legacy.sql file
- #4341, Using "support function" API in PgSQL 12+ to replace SQL inlining
as the mechanism for providing index support under ST_Intersects, et al
- #4330, postgis_restore OOM when output piped to an intermediate process
(Hugh Ranalli)
- #4322, Support for Proj 6+ API, bringing more accurate datum transforms
and support for WKT projections
- #4153, ST_Segmentize now splits segments proportionally (Darafei
......
......@@ -94,6 +94,8 @@ die "$me:\tUnable to open dump file '$dumpfile'.\n" if ! -r $dumpfile;
print STDERR "Converting $dumpfile to ASCII on stdout...\n";
STDOUT->autoflush(1);
######################################################################
# Load the signatures of things to skip.
#
......@@ -265,7 +267,7 @@ while( my $l = <INPUT> ) {
#
elsif ( $l =~ /CREATE TABLE *([^ ,]*)/)
{
my @sublines = ($l);
print STDOUT $l;
while( my $subline = <INPUT>)
{
if ( $subline =~ /CONSTRAINT "?enforce_dims_/i ) {
......@@ -281,10 +283,9 @@ while( my $l = <INPUT> ) {
print STDERR "WARNING: could not find SRID value in: $subline";
}
}
push(@sublines, $subline);
print STDOUT $subline;
last if $subline =~ /;[\t ]*$/;
}
print STDOUT @sublines;
next;
}
......@@ -292,15 +293,13 @@ while( my $l = <INPUT> ) {
# See http://trac.osgeo.org/postgis/ticket/2759
elsif ( $l =~ /^COMMENT ON .* IS '(.*)/)
{
my @sublines = ($l);
my $comment = $1;
print STDOUT $l;
while( my $subline = <INPUT>)
# A comment ends with an odd number of single quotes and a semicolon
while( $comment !~ /('*)[\t ]*;[\t ]*$/ || length($1) % 2 == 0)
{
$comment = <INPUT>;
push(@sublines, $comment);
print STDOUT $subline;
last if ( $subline !~ /('*)[\t ]*;[\t ]*$/ || length($1) % 2 == 0)
}
print STDOUT @sublines;
next;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment