1

I am trying to import a CSV file into Posgres that has a comma as delimiter. I do:

\COPY products(title, department) from 'toyd.csv' with (DELIMITER ',');

All super cool.

However, title and department are both strings. I have some commas that are in these columns that I don't want to be interpreted as delimiters. So I pass the strings in quotes. But this doesn't work. Postgres still thinks they are delimiters. What are my missing?

Here is a snippet from the CSV that causes the problem:

"Light","Reading, Writing & Spelling"

Any ideas?

More Than Five
  • 9,311
  • 20
  • 72
  • 121

1 Answers1

3

You aren't using CSV format there, just a comma-delimited one.

Tell it you want FORMAT CSV and it should default to quoted text - you could also change the quoting character if necessary.

Richard Huxton
  • 19,615
  • 3
  • 35
  • 46