Opened 10 years ago

Closed 10 years ago

#2759 closed defect (fixed)

script 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:


Migrating a postgis database from v1.5 to 2.1.3, the 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)

test.backup (1.1 KB ) - added by xcaeag 10 years ago.
small backup for tests

Download all attachments as: .zip

Change History (10)

comment:1 by robe, 10 years ago

Component: postgisbuild/upgrade/install
Milestone: PostGIS 2.1.4
Owner: changed from pramsey to strk

comment:2 by strk, 10 years ago

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…

comment:3 by strk, 10 years ago

Line 171 of 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 xcaeag, 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 strk, 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

by xcaeag, 10 years ago

Attachment: test.backup added

small backup for tests

comment:6 by xcaeag, 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 strk, 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:8 by xcaeag, 10 years ago

It's perfect for us! Thank you, the patch is better done like that!

comment:9 by strk, 10 years ago

Resolution: fixed
Status: newclosed

Thanks for testing. Backported to 2.1 branch (2.1.4) with r12919

Note: See TracTickets for help on using tickets.