
On Sat, 17 Oct 2015 09:38:35 +1100 Chris Samuel <chris@csamuel.org> wrote:
On Fri, 16 Oct 2015 08:23:50 PM h wrote:
Can someone help me to get the empty double quoted value accepted as a NULL value for date and for time?
I've never touched PostgreSQL I'm afraid, but a quick google implies that if you are using "COPY FROM" to import the CSV you can use the NULL argument to specify what to use as the CSV equivalent to NULL.
http://www.postgresql.org/docs/9.3/static/sql-copy.html
# NULL # Specifies the string that represents a null value. The default is \N # (backslash-N) in text format, and an unquoted empty string in CSV # format. You might prefer an empty string even in text format for cases # where you don't want to distinguish nulls from empty strings. This # option is not allowed when using binary format.
Best of luck! Chris
Thanks Chris, Unfortunately I found this: https://wiki.postgresql.org/wiki/COPY#Caveats_with_implementation - an empty string is always an empty string. I did not want to, but I will have to do a pre-process on my csv files. Ta again, H