Take the 2-minute tour ×

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?

share|improve this question
How are the commas escaped? There are different patterns but the two I am familiar with is ',,' == ',' or '\,' = ','. If I remember correctly the previous is a more standard csv. –  Daniel B. Chapman Aug 29 '13 at 14:24
If these quotes are double quotes, this should work. Otherwise, maybe show a part of your CSV file. –  Daniel Vérité Aug 29 '13 at 14:27
If it is possible, then you can try changing the delimiter manually and then importing it. –  heretolearn Aug 29 '13 at 14:58
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer


