Copy Documentation
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/14/sql-copy.html
Description:
The documentation states that headers are only used for CSV files, but there
is a header "PGCOPY" when using a BINARY export. e.g.
COPY (SELECT zipfile FROM file_upload) TO PROGRAM 'cat > /tmp/dunc ' (FORMAT
binary);
Please can we have an example of using COPY (server/plpgsql) to copy a bytea
(eg image) column to an image file, unchanged - i.e. no headers.
On Thursday, February 17, 2022, PG Doc comments form <noreply@postgresql.org>
wrote:
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/14/sql-copy.html
Description:The documentation states that headers are only used for CSV files, but
there
is a header "PGCOPY" when using a BINARY export. e.g.
COPY (SELECT zipfile FROM file_upload) TO PROGRAM 'cat > /tmp/dunc '
(FORMAT
binary);
Please can we have an example of using COPY (server/plpgsql) to copy a
bytea
(eg image) column to an image file, unchanged - i.e. no headers.
To my knowledge there is no such example possible. If you want to export
the contents of a bytea to a file you need to do so using client-side code,
pulling the data from a normal resultset. This includes using an untrusted
language function.
David J.