postgresql copy 消息
Posted 黑暗森林
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了postgresql copy 消息相关的知识,希望对你有一定的参考价值。
简单查询两个特殊的copy的返回值
https://www.postgresql.org/do...
CopyInResponse
The backend is ready to copy data from the frontend to a table; see Section 52.2.5.
CopyOutResponse
The backend is ready to copy data from a table to the frontend; see Section 52.2.5.
copy 相关消息
CommandComplete (B)
Byte1(\'C\')
Identifies the message as a command-completed response.
其中:String
For a COPY command, the tag is COPY rows where rows is the number of rows copied. (Note: the row count appears only in PostgreSQL 8.2 and later.)
CopyData (F & B)
Byte1(\'d\')
Identifies the message as COPY data.
CopyDone (F & B)
Byte1(\'c\')
Identifies the message as a COPY-complete indicator.
CopyFail (F)
Byte1(\'f\')
Identifies the message as a COPY-failure indicator.
CopyInResponse (B)
Byte1(\'G\')
Identifies the message as a Start Copy In response. The frontend must now send copy-in data (if not prepared to do so, send a CopyFail message).
CopyOutResponse (B)
Byte1(\'H\')
Identifies the message as a Start Copy Out response. This message will be followed by copy-out data.
CopyBothResponse (B)
Byte1(\'W\')
Identifies the message as a Start Copy Both response. This message is used only for Streaming Replication.
copy to file
postgres=# copy (select * from t1 ) to \'/tmp/t1.csv\';
COPY 5
copy from stdin
postgres=# copy t1 from stdin (DELIMITER \'|\');
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.
>> 23|gg
>> 24|qq
>> 25|tt
>> COPY 3
copy to stdout
postgres=# copy t1 to STDOUT (DELIMITER \'|\');;
23|gg
24|qq
25|tt
以上是关于postgresql copy 消息的主要内容,如果未能解决你的问题,请参考以下文章
PSQL /copy : 变量替换不起作用 | PostgreSQL 11