Re: Copy Documentation

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "duncan(at)rotherbridge(dot)com(dot)au" <duncan(at)rotherbridge(dot)com(dot)au>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: Copy Documentation
Date: 2022-02-18 14:51:12
Message-ID: CAKFQuwbHbRMzkzCjioV-8LvtNCJnJ4H81xH4PUg7+iy_3OLhJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thursday, February 17, 2022, PG Doc comments form <noreply(at)postgresql(dot)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.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Fujii Masao 2022-02-18 16:05:04 Re: maximum number of backtrace frames logged by backtrace_functions
Previous Message Peter Eisentraut 2022-02-18 10:59:17 Re: maximum number of backtrace frames logged by backtrace_functions