【发布时间】:2011-09-01 01:41:34
【问题描述】:
我想使用 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' 不正确,如何指定选项卡?
【问题讨论】:
-
试试错误信息提示的内容:
\copy cm_state from 'state.data' with delimiter E'\t' null as ';' -
E 开始一个转义序列。把 E 想象成 C 中的双引号字符串。E'\t' == "\t"。
标签: postgresql csv