Postgresql uses the copy command to import data and reports an error: ERROR: unterminated CSV quoted field

1. Error reporting

ERROR:unterminated CSV quoted field

CONTEXT:COPY t101_armoa_prblm_tbl,line 202:"31-Mar-23,abc,0,2,,334221,3,,3,0,1,,,2012/1/1 ..."

Two, solve

        2.1, copy command

\copy t101_armoa_prblm_tbl from 'armoa_prblm_tbl.csv' with csv header;

        

        2.2. Reasons

                The high probability is that the content in a certain cell in a row has quotation marks (single quotation, double quotation, etc.) at the beginning or end, but no quotation marks at the end, or there are fewer quotation marks at the beginning or end. The following situations are listed below:

        1、"xxxxxx

        2、xxxxxx"

        3、’xxxxx"

        4、”xxxxx'

        2.3. Processing

                Find this line and add the corresponding quotation marks manually. Use the copy command again, and the import is successful. 

Guess you like

Origin blog.csdn.net/zkkkkkkkkkkkkk/article/details/130482397