Ticket #104 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

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) (diff)

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

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

Change History

Changed 4 years ago by pramsey

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

Changed 4 years ago by robe

That seems to work. You going to commit?

Changed 4 years ago by pramsey

Committed at r3623

Changed 4 years ago by robe

sample file

Changed 4 years ago by robe

  • status changed from closed to reopened
  • resolution fixed deleted
  • description modified (diff)

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.

Changed 4 years ago by mcayland

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.

Changed 4 years ago by robe

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.

Changed 4 years ago by mcayland

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.

Changed 4 years ago by robe

  • status changed from reopened to closed
  • resolution set to fixed

Seems fine now

Note: See TracTickets for help on using tickets.