Opened 16 years ago

Closed 16 years ago

#104 closed defect (fixed)

shp2pgsql is using deprecated PostgreSQL escape syntax

Reported by: robe Owned by: robe
Priority: low Milestone:
Component: postgis Version:
Keywords: Cc:

Description (last modified by robe)

For some datasets I get this

HINT: Use the escape string syntax for backslashes, e.g., E'
'. WARNING: nonstandard use of
in a string literal LINE 1: ...w','St','Brighton','02135','Residential','3','R3','
2003
2...

Attachments (2)

esc.patch (0 bytes ) - added by robe....@… 16 years ago.
http://postgis.googlecode.com/issues/attachment?aid=-5423139989644836315&name=esc.patch
Aban01.zip (12.7 KB ) - added by robe 16 years ago.
sample file

Download all attachments as: .zip

Change History (10)

comment:1 by pramsey, 16 years ago

Try this micro-patch and see if it goes away...

comment:2 by robe, 16 years ago

That seems to work. You going to commit?

comment:3 by pramsey, 16 years ago

Committed at r3623

by robe, 16 years ago

Attachment: Aban01.zip added

sample file

comment:4 by robe, 16 years ago

Description: modified (diff)
Resolution: fixed
Status: closedreopened

I think the changes done in #123 r3989 broke this and worst yet, I can no longer import my sample file with either shp2pgsql or the shp2pgsql gui. Gives the annoying escape errors and also that I have invalid characters for SQL ASCII or some such thing. The -W latin1 also doesn't work.

Try attached file.

comment:5 by mcayland, 16 years ago

Thanks for the report Regina. Since I have standard_conforming_strings enabled on my installation, I missed the fact that I need to explicitly set this in the output file for people that don't. Should now be fixed in r3994 - please test your end and close if it works.

ATB,

Mark.

comment:6 by robe, 16 years ago

Mark, Well you partly fixed it. I can now import, BUT the gui still gives the warning

HINT: Use the escape string syntax for escapes, e.g., E'\r\n'. WARNING: nonstandard use of escape in a string literal LINE 1: ...,'Av','Roslindale','02131','Residential','3','R3','\2003\200... The shp2pgsql as far as I can tell is perfectly fine now, but I'll test with more shapefile loadings I have lying around.

comment:7 by mcayland, 16 years ago

Okay, it looks as if I missed part of the conversion, i.e. sprintf()s need to be changed to pgis_exec(). Can you try again now and see if works?

ATB,

Mark.

comment:8 by robe, 16 years ago

Resolution: fixed
Status: reopenedclosed

Seems fine now

Note: See TracTickets for help on using tickets.