Importing CSV and commas in string values

前端 未结 1 1928
孤城傲影
孤城傲影 2021-01-13 00:13

I use postgres 8.4 and currently trying to import a trivial CSV:

Here is a table:

CREATE TABLE public.sample (
  a VARCHAR, 
  b VARCHAR
) WITHOUT OI         


        
相关标签:
1条回答
  • 2021-01-13 00:35

    Clearly you have a CSV file while you try to import it as text format. Use:

    COPY sample FROM '/tmp/sample.csv' FORMAT CSV;
    

    The default delimiter for CSV format is the comma (,) anyway. More in the manual. Syntax is for current version 9.1. For PostgreSQL 8.4:

    COPY sample FROM '/tmp/sample.csv' CSV;
    
    0 讨论(0)
提交回复
热议问题