I’m using this:
COPY( select field1, field2, field3 from table ) TO ‘C://Program
Files/PostgreSql//8.4//data//output.dat’ WITH BINARY
To export some fields to a file, one of them is a ByteA field. Now, I need to read the file with a custom made program.
How can I parse this file?
The general format of a file generated by
COPY...BINARYis explained in the documentation, and it’s non-trivial.byteacontents are the most easy to deal with, since they’re not encoded.Each other datatype has its own encoding rules, which are not described in the documentation but in the source code. From the doc: