]> granicus.if.org Git - postgis/commitdiff
Do not skip lines starting with "--" from comments (#2759)
authorSandro Santilli <strk@keybit.net>
Tue, 26 Aug 2014 09:41:08 +0000 (09:41 +0000)
committerSandro Santilli <strk@keybit.net>
Tue, 26 Aug 2014 09:41:08 +0000 (09:41 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12918 b70326c6-7e19-0410-871a-916f4a2858ee

utils/postgis_restore.pl.in

index e074d863f3c5fd42d47f40e5bce150838ad6402e..78e2432544f0e16ee4ffe7d9ac4fcbbb55cec802 100755 (executable)
@@ -277,6 +277,22 @@ while( my $l = <INPUT> ) {
     next;
   }
 
+  # Parse comments, to avoid skipping quoted comments
+  # See http://trac.osgeo.org/postgis/ticket/2759
+  elsif ( $l =~ /^COMMENT ON .* IS '(.*)/)
+  {
+    my @sublines = ($l);
+    my $comment = $1;
+    # 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 @sublines;
+    next;
+  }
+
   # Clamp SRIDS in spatial_ref_sys
   elsif ( $l =~ /COPY spatial_ref_sys /)
   {