postgresql使用copy命令导入数据报错:ERROR:unterminated CSV quoted field

一、报错

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 ..."

二、解决

        2.1、copy命令

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

        

        2.2、原因

                大概率是因为某一行中某个单元格里内容开始或结束是具有引号(单引、双引等),但结尾没有用引号,又或是开始或结尾少加引号。列如下面几种情况:

        1、"xxxxxx

        2、xxxxxx"

        3、’xxxxx"

        4、”xxxxx'

        2.3、处理

                找到这一行,手动加上对应的引号即可。再次使用copy命令,导入成功。 

猜你喜欢

转载自blog.csdn.net/zkkkkkkkkkkkkk/article/details/130482397