
On Sun, Oct 18, 2015 at 01:08:55PM +1100, h wrote:
Unfortunately I found this: https://wiki.postgresql.org/wiki/COPY#Caveats_with_implementation - an empty string is always an empty string.
not surprising. COPY requires perfect or near-perfect input. Most allegedly-CSV files are far from perfect.
I did not want to, but I will have to do a pre-process on my csv files.
alternatively, you could write a perl script that reads the csv files using DBD::CSV and exports the data to a postgres database using DBD::Pg, performing any transformations of the data as required - i've done this several times in the past when i needed to import client-supplied CSV files into a database. DBD::CSV is very flexible and forgiving of semi-broken and non-standard CSV (which is about 99% of all CSV files in the wild). craig