Opened 16 years ago
Closed 5 years ago
#1977 closed defect (wontfix)
field names aliases for postgis database concerning '-'and '#'characters in field names
Reported by: | johantenbreteler | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | OGR_SRS | Version: | unspecified |
Severity: | normal | Keywords: | postgis PG launder |
Cc: | Mateusz Łoskot |
Description
Field names of layers containing and- '#' characters will be aliased with field names in which this character(s) will be replaced by underscore '_' ; Ogr2ogr does it fine , only the postgis tables with the alias column names are not filled with values. Ogr2ogr should fill the column values for the alias columns with the original values. The column header name should be the alias name. The same story is valid for the GML conversion.
Change History (2)
comment:1 by , 16 years ago
Cc: | added |
---|---|
Keywords: | postgis PG launder added |
Priority: | high → normal |
Status: | new → assigned |
comment:2 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | assigned → closed |
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.
To restate the problem, the OGRFeature::SetFrom() method used by ogr2ogr depends on being able to copy field values from the source feature to the destination feature based on corresponding field names. If the field names do not correspond then field values are not copied.
But the PG driver launders field names to avoid characters illegal (without quoting) in postgres. There are other drivers that also modify field names (such as the shapefile driver which truncates length).
We could partially work around this by having the CreateField() method create the OGRFieldDefn with the original name, instead of the laundered name. This would mean that original translations with ogr2ogr would work. But attempts to append to the table (for instance) would fail.
I'd add that the OGRFeature::SetFrom() method is fairly widely used, and this isn't necessarily just a problem in the context of ogr2ogr.
This will require some thinking...