#591·pq

NULL handling for bulk COPY operations

Author: mandolyteCreated Mar 24, 2017Updated Mar 18, 2026
Labelsbug

I am bulk loading large CSV files, but have not found a way to indicate how to treat nulls. I am working around the problem by creating my target tables using all TEXT data types. But for dates, if the input is empty, it errs since it isn't properly formatted as a date.

I have searched the issues and documentation and haven't found a reference to how to set the PG option NULL 'null_string' (from https://www.postgresql.org/docs/9.2/static/sql-copy.html). I'm probably missing something obvious. If I am, treat this as a suggestion to update the godocs.

Thanks!