Opened 12 years ago

Closed 12 years ago

#1865 closed defect (fixed)

Data loss in postgis_restore.pl when data rows have leading dashes

Reported by: darkpanda Owned by: strk
Priority: high Milestone: PostGIS 1.5.5
Component: postgis Version: 1.5.X
Keywords: Cc:

Description

postgis_restore.pl can skip over valid data in COPY statements if a row line begins with leading dashes, i.e. appears to be an SQL comment.

Attached is a patch that checks for COPY commands and for the accompanying "\." line that completes them and avoids stripping comments for the duration.

Attachments (2)

Change History (9)

comment:1 by strk, 12 years ago

Resolution: fixed
Status: newclosed

Thanks! r9905 in 2.0 branch, r9906 in trunk

comment:2 by darkpanda, 12 years ago

I think the same issue exists in older versions of PostGIS as well, so if there were any plans for further 1.5 releases the same style of fix should probably be applied there as well. I haven't had to use postgis_restore.pl on my older 1.5 databases, but I'm assuming the same issue will occur around line 648. I haven't personally confirmed this however, but that's what it looks like in the code.

I can write a quick patch if y'all want, but I believe the few lines that the patch consists of are going to be pretty much identical to the existing patch.

comment:3 by strk, 12 years ago

Milestone: PostGIS 2.0.1PostGIS 1.5.4
Resolution: fixed
Status: closedreopened
Version: 2.0.x1.5.X

I'll happily commit a patch (or pull it from a git branch)

comment:4 by darkpanda, 12 years ago

Alright, I gave it a shot. See the latest attached patch against the 1.5 branch.

comment:5 by robe, 12 years ago

Milestone: PostGIS 1.5.4PostGIS 1.5.5

comment:6 by robe, 12 years ago

Owner: changed from pramsey to strk
Status: reopenednew

comment:7 by strk, 12 years ago

Resolution: fixed
Status: newclosed

r10049 in 1.5 branch — all done

Note: See TracTickets for help on using tickets.