Opened 7 years ago

Closed 7 years ago

#6820 closed defect (invalid)

ogr2ogr import null values in a csv file as an empty string into postgis

Reported by: yanfuz Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: critical Keywords:
Cc:

Description

I have discovered a bug for ogr2ogr command. When using ogr2ogr to import *.csv to postgis, if the csv file has null values, see below example: Longitude, latitude, sometext, type -41.95,96.781 -23.80,90.311 -35.87,95.23,cat,0 After the import, the null (which is in the csv), will result in ‘’ (single quotation marks) in the postgis table.

A similar problem can be found at here: http://lists.osgeo.org/pipermail/gdal-dev/2013-January/035323.html

Attachments (1)

ogr2ogr_test.zip (3.6 KB ) - added by yanfuz 7 years ago.
A test code for test ogr2ogr

Download all attachments as: .zip

Change History (2)

by yanfuz, 7 years ago

Attachment: ogr2ogr_test.zip added

A test code for test ogr2ogr

comment:1 by Even Rouault, 7 years ago

Resolution: invalid
Status: newclosed

You can use the EMPTY_STRING_AS_NULL=YES open option

ogr2ogr -update PG:xxxxx in.csv -oo EMPTY_STRING_AS_NULL=YES

Note: See TracTickets for help on using tickets.