Opened 19 years ago
Closed 9 years ago
#721 closed defect (fixed)
Shapefile has repeated fields, ogr2ogr bails on defining the second in postgis
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description (last modified by )
This file sucks and I don't expect ogr2ogr to handle buggy data, but it would be nice if it could handle this inconsistency rather than letting PostGIS halt the process. Could ogr2ogr handle checking for problematic field names (i.e. duplicates) rather than leaving it up to PostGIS to complain? It'd be even greater if it could rename repeated attributes before getting that far. Perhaps there is already an lco that I'm not aware of? > ogr2ogr -f "PostgreSQL" "PG:dbname=project1" pres_nov28.shp ERROR 1: ALTER TABLE "pres_nov28" ADD COLUMN "state_fips" CHAR(12) ERROR: column "state_fips" of relation "pres_nov28" already exists ERROR 1: ALTER TABLE "pres_nov28" ADD COLUMN "cnty_fips" CHAR(13) ERROR: column "cnty_fips" of relation "pres_nov28" already exists ERROR 1: INSERT command for new feature failed. ERROR: new row for relation "pres_nov28" violates check constraint "$2" ERROR 1: Terminating translation prematurely after failed translation of layer pres_nov28
Change History (4)
comment:2 by , 19 years ago
Frank, just FYI: the v.in.ogr in GRASS comes with 'cnames' parameter which permits to rename fields on the fly while importing. http://grass.itc.it/grass60/manuals/html60_user/v.in.ogr.html Markus
comment:3 by , 9 years ago
Description: | modified (diff) |
---|
Feels useless to keep this ticket open forever. Duplicate field names can be changed by using .VRT file in between or with SQL SELECTs.
comment:4 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.