如何在postgres前端COPY中指定选项卡 [英] How to specify a tab in a postgres front-end COPY
本文介绍了如何在postgres前端COPY中指定选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用psql \copy命令将制表符分隔的文件中的数据拉入Postgres。我正在使用此命令:
I would like to use the psql "\copy" command to pull data from a tab-delimited file into Postgres. I'm using this command:
\copy cm_state from 'state.data' with delimiter '\t' null as ;
但是我收到此警告(表实际上可以正常加载):
But I'm getting this warning (the table actually loads fine):
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'不正确,如何指定制表符?
How do I specify a tab if '\t' is not correct?
推荐答案
使用 E'\t'
告诉PostgreSQL那里可能有转义字符:
Use E'\t'
to tell postgresql there may be escaped characters in there:
\copy cm_state from 'state.data' with delimiter E'\t' null as ;
这篇关于如何在postgres前端COPY中指定选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文