3

I have a lot of S57 files that need to be imported to PostgresDB. The process takes over 2 hours. In order to improve performance, I have tried using PG_USE_COPY to use copy instead of DB inserts. I am however getting the following error.

Using: GDAL 1.9.1

Env set for:

SET PGCLIENTENCODING=LATIN1

SET PG_USE_COPY=YES

Command: ogr2ogr -update -append -f "PostgreSQL" PG:"dbname='ENCTest' host='127.0.0.1' port='5432' user='postgres' password='postgres'" *.000

1/959 Processing file: US1AK90M.000 1492KB Warning 1: Attributes Radar ignored, not in expected schema. No more warnings will be issued for this dataset.

ERROR 1: COPY statement failed.

ERROR: malformed array literal: "{"02260892A1C50F"

CONTEXT: COPY bcnspp, line 1, column lnam_refs: "{"02260892A1C50F"

2
  • Seems your need to add Radar to your schema: "Attributes Radar ignored, not in expected schema."
    – Mapperz
    Nov 6, 2012 at 15:57
  • I don't think that is the issue. When I use inserts instead of copy by removing PG_USE_COPY setting, the process has a few warnings but no errors, and goes through fine. Nov 7, 2012 at 2:48

2 Answers 2

1

I seemed to have fixed this issue. I upgraded to GDAL 1.9.2, upgraded to Postgres 9.3 and did this on Python 2.7. I also configured the PATH variable to use GDAL ahead of Postgres as there is a GDAL version under postgres (postgis raster support).

This seemed to do the job. I am able to use COPY and retained the Client Encoding to LATIN1.

0

I've seen similar problems with Postgres 9.2 which has changed binary encoding. Maybe ogr does not support it yet? Can you try with another database with older Postgres version (8.4 for instance)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.