When there are commas inside fields and block is given there is a problem with row values.
Line is split by delimiter, regardless of CSV format, and when delimiter is a comma, row has more values than there are columns.
I've added a test that demonstrates the issue.
To fix it, I've simply added CSV lib to parse the line and avoid splitting just by delimiter. Line is split with regards to CSV format.
When yield finishes, line is again generated by CSV lib generate_line to ensure the line is a valid CSV line.
Hey @diogob,
I've noticed and issue while using
postgres-copy
.When there are commas inside fields and block is given there is a problem with
row
values. Line is split by delimiter, regardless of CSV format, and when delimiter is a comma,row
has more values than there are columns.I've added a test that demonstrates the issue.
To fix it, I've simply added CSV lib to parse the line and avoid splitting just by delimiter. Line is split with regards to CSV format.
When
yield
finishes, line is again generated by CSV libgenerate_line
to ensure the line is a valid CSV line.Please let me know what you think!