Opened 10 years ago
Closed 10 years ago
#2759 closed defect (fixed)
script postgis_restore.pl fails on some complexes comments
Reported by: | xcaeag | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.1.4 |
Component: | build | Version: | 2.1.x |
Keywords: | Cc: |
Description
Migrating a postgis database from v1.5 to 2.1.3, the postgis_restore.pl script fails on some complexes comments (containing comments themselves!)
The SQL script generated is no longer functional.
The removal of the 171 line of the file seems to correct the problem.
L171 : # next if !$inCopy && $l =~ / *—/;
Attachments (1)
Change History (10)
comment:1 by , 10 years ago
Component: | postgis → build/upgrade/install |
---|---|
Milestone: | → PostGIS 2.1.4 |
Owner: | changed from | to
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Line 171 of postgis_restore.pl in trunk indeed matches what you reported, but I remember it was needed to avoid skipping lines starting with an sql-comment (—) within a COPY FROM STDIN block. Commenting that out would re-introduce that bug. See #1865
comment:4 by , 10 years ago
I admit that the scenario is not ordinary : These are lines that contain double minus-sign in a commentary table for example.
Sometimes, if this line disappears, the comment will not be closed properly in output.
COMMENT ON TABLE my_table IS 'A comment, with somes - -- line 1';
Commenting line 171 allowed us (in our case) to migrate our schema.
comment:5 by , 10 years ago
Do you have the dump around to test a different patch ? To be robust the patch should recognize COMMENT lines and find the correct end of the command
comment:6 by , 10 years ago
attached file (single table, schema only, no data. schema:'dce') generated with :
pg_dump -s -h localhost -Fc -b -v -t dce.station -f "test.backup" refgeo2
comment:7 by , 10 years ago
Please see how you like r12918 (in trunk). Seems to work fine for your case too, and I tested with a couple more combinations
comment:9 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Thanks for testing. Backported to 2.1 branch (2.1.4) with r12919
xcaeag, can you provide a small example of a dump that fails to be restored ? Also a patch would help, in case line 171 changed…