Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Walter wrote:
>> I have a problem using the copy command on a CSV file.
>>
>> All of the values within the CSV are surrounded with quotation marks. So
>> a null value for a field looks like ""
> It should be ,, for NULL.
> Have you tried WITH NULL AS ''?
Won't help --- that will match a field that is empty and *doesn't* have
quotes.
It seems like the only way to read broken "CSV" files like this would be
to have some option that's sort of the opposite of FORCE NOT NULL ---
that is, force an empty-string data value to be treated as NULL even if
quoted. I'm not in favor of adding that particular frammish, but if
there are enough broken applications out there putting out this sort
of file, we may not have much choice...
Exactly where did this not-really-a-CSV-file come from?
regards, tom lane