Skip to main content

csv_blank_line_is_record

Function csv_blank_line_is_record 

Source
pub fn csv_blank_line_is_record(column_count: usize) -> bool
Expand description

Returns whether a blank line in CSV COPY FROM STDIN input is a record when column_count columns are copied.

A blank line is one unquoted empty field. For one column that is a full row, and how COPY TO writes a NULL under the default NULL marker. For no columns it is the only way to write a row.

NOTE: For several columns PostgreSQL fails a blank line with missing data for column. We skip it there, so that files with a stray blank line keep loading: COPY skipped every blank line before one could be a record. With HEADER, the header is then the first line that is not blank.