问题描述
||
我想使用psql \“ \\ copy \”命令将数据从制表符分隔的文件中提取到Postgres中。我正在使用以下命令:
\\copy cm_state from \'state.data\' with delimiter \'\\t\' null as ;
但是我收到此警告(该表实际上可以正常加载):
WARNING: nonstandard use of escape in a string literal
LINE 1: COPY cm_state FROM STDIN DELIMITER \'\\t\' NULL AS \';\'
HINT: Use the escape string syntax for escapes,e.g.,E\'\\r\\n\'.
如果\'\\ t \'不正确,如何指定标签?
解决方法
使用ѭ2告诉PostgreSQL那里可能有转义字符:
\\copy cm_state from \'state.data\' with delimiter E\'\\t\' null as ;
,你可以做到这一点copy cm_state from stdin with (format \'text\')