CSV 行示例:
"2012","Test User","ABC","First","71.0","","","0","0","3","3","0","0","","0","","","","","0.1","","4.0","0.1","4.2","80.8","847"
“First”之后的所有值都是数字列。很多 NULL 值就是这样引用的,对。
尝试复制:
copy mytable from 'myfile.csv' with csv header quote '"';
不:ERROR: invalid input syntax for type numeric: ""
嗯,是的。这是一个空值。在复制时尝试 2:
copy mytable from 'myfile.csv' with csv header quote '"' null '""';
不:ERROR: CSV quote character must not appear in the NULL specification
帅哥要做什么?在运行之前从文件中删除所有双引号COPY
?可以做到这一点,但我认为对于必须是一个非常普遍的问题有一个适当的解决方案。