Opened 14 years ago
Closed 14 years ago
#3567 closed defect (fixed)
CreateFeature returns OGRERR_NONE but feature is not created
Reported by: | manelclos | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | 1.5.4 |
Severity: | normal | Keywords: | |
Cc: |
Description
Hi,
Postgresql 8.4 + postgis, Python-gdal 1.5.4,
If iso-8859-1 strings are assigned to the feature fields, CreateFeature will return "0" but it won't be created in the database.
# need to convert strings or feature won't be created if value.__class__ == str: value = value.decode('iso-8859-1') value = value.encode('utf-8') f2.SetField(str(targetfield), value) target_layer.CreateFeature(f2)
Expected: error when the feature is not created.
Severity: major, silent data loss.
Change History (2)
comment:1 by , 14 years ago
Component: | PythonBindings → OGR_SF |
---|---|
Owner: | changed from | to
Severity: | major → normal |
comment:2 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Closing. Lack of feedback from reporter
Note:
See TracTickets
for help on using tickets.
I doubt this is related with the Python bindings.
Is the issue really specific to encoding issue ? Does it work better when just using ASCII strings ? If so, you should check the encoding settings of your PG DB. You could also play with the PGCLIENTENCODING environment variable environment variable. See http://www.gdal.org/ogr/drv_pg.html
Are you sure you're not using transactions ? If so, remind to close the transaction otherwise the changes will be lost.
In my terminal configured as ISO-8859-15 and the PG DB being UTF-8, I tried this
It returns 0 but there was a warning and a record was created (the PG lib tries to interpret at his best the invalid UTF-8 content).
I'd note 1.5.4 version begins to age a bit now. Perhaps you could try with a more recent version ?