我正在使用这个:
copY( select field1,field2,field3 from table ) TO ‘C://Program
Files/Postgresql//8.4//data//output.dat’ WITH BINARY
要将某些字段导出到文件,其中一个是ByteA字段.现在,我需要使用自定义程序读取文件.
我该如何解析这个文件?
解决方法
copY … BINARY生成的文件的一般格式在
documentation中进行了解释,这是非常重要的.
bytea内容是最容易处理的,因为它们没有被编码.
每个其他数据类型都有自己的编码规则,这些规则在文档中没有描述,但在源代码中没有描述.来自doc:
To determine the appropriate binary format for the actual tuple data you should consult the Postgresql source,in particular the *send and *recv functions for each column’s data type (typically these functions are found in the src/backend/utils/adt/ directory of the source distribution).
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。