pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedDownload file from COPY ... TO with pgadmin
3+ messages / 3 participants
[nested] [flat]
* Download file from COPY ... TO with pgadmin
@ 2023-01-31 13:02 Marco Lechner <mlechner@bfs.de>
0 siblings, 2 replies; 3+ messages in thread
From: Marco Lechner @ 2023-01-31 13:02 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Hi,
Using COPY …TO it is possible to store e.g. the “value” of a bytea cell in a directory on the server. E.g. by this:
COPY (SELECT content FROM d_doc WHERE id = 'x123456') TO CONCAT('/tmp/mydoc.pdf’) (FORMAT binary);
As we do not have access to the postgresql fileserver (ssh, …), but can SELECT the value of the bytea cell, is It possible to download the bytea directly into a file on a client computer when using pgadmin? Is there a solution with the COPY … TO command, any pgadmin specific feature or any other simple solution?
Regards
Marco
i.A. Dr. Marco Lechner
Leiter Fachgebiet RN 1 │ Head RN 1
--
Bundesamt für Strahlenschutz │ Federal Office for Radiation Protection
Koordination Notfallschutzsysteme │ Coordination Emergency Systems │ RN 1
Rosastr. 9
D-79098 Freiburg
Tel.: +49 30 18333-6724
E-Mail: mlechner@bfs.de<mailto:mlechner@bfs.de>
www.bfs.de<http://www.bfs.de/;
🌐 Besuchen<https://www.bfs.de/; Sie unsere Website, folgen Sie uns auf Twitter<https://www.twitter.com/strahlenschutz; und abonnieren<https://www.bfs.de/strahlenschutzaktuell; Sie unseren 📢 Newsletter.
🔒 Informationen zum Datenschutz<https://www.bfs.de/datenschutz; gemäß Artikel 13 DSGVO
💚 E-Mail drucken? Lieber die Umwelt schonen!
--
Hinweis zu Anhängen die auf .p7m/.p7c/.p7s oder .asc/.asc.sig enden:
Die .p7?- und .asc-Dateien sind ungefährliche Signaturdateien (digitale Unterschriften). In E-Mail-Clients mit S/MIME Konfiguration (.p7?) oder PGP-Erweiterung (.asc) dienen sie zur:
- Überprüfung des Absenders
- Überprüfung einer evtl. Veränderung des Inhalts während der Übermittlung über das Internet
Die Signaturdateien können ebenso dazu verwendet werden dem Absender dieser Signatur eine E-Mail mit verschlüsseltem Inhalt zu senden. In E-Mail-Clients ohne S/MIME Konfiguration oder PGP-Erweiterung erscheinen die Dateien als Anhang und können ignoriert werden.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Download file from COPY ... TO with pgadmin
@ 2023-01-31 13:58 Erik Wienhold <ewie@ewie.name>
parent: Marco Lechner <mlechner@bfs.de>
1 sibling, 0 replies; 3+ messages in thread
From: Erik Wienhold @ 2023-01-31 13:58 UTC (permalink / raw)
To: Marco Lechner <mlechner@bfs.de>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
> On 31/01/2023 14:02 CET Marco Lechner <mlechner@bfs.de> wrote:
>
> Using COPY …TO it is possible to store e.g. the “value” of a bytea cell in a
> directory on the server. E.g. by this:
>
> COPY (SELECT content FROM d_doc WHERE id = 'x123456') TO CONCAT('/tmp/mydoc.pdf’) (FORMAT binary);
>
> As we do not have access to the postgresql fileserver (ssh, …), but can SELECT
> the value of the bytea cell, is It possible to download the bytea directly
> into a file on a client computer when using pgadmin? Is there a solution with
> the COPY … TO command, any pgadmin specific feature or any other simple solution?
Use psql with \copy which targets the client file system. pgAdmin 5.4+ can also
launch psql.
--
Erik
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Download file from COPY ... TO with pgadmin
@ 2023-01-31 16:30 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Marco Lechner <mlechner@bfs.de>
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Klaver @ 2023-01-31 16:30 UTC (permalink / raw)
To: Marco Lechner <mlechner@bfs.de>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On 1/31/23 05:02, Marco Lechner wrote:
> Hi,
>
> Using COPY …TO it is possible to store e.g. the “value” of a bytea cell
> in a directory on the server. E.g. by this:
>
> COPY (SELECT content FROM d_doc WHERE id = 'x123456') TO
> CONCAT('/tmp/mydoc.pdf’) (FORMAT binary);
>
> As we do not have access to the postgresql fileserver (ssh, …), but can
> SELECT the value of the bytea cell, is It possible to download the bytea
> directly into a file on a client computer when using pgadmin? Is there a
> solution with the COPY … TO command, any pgadmin specific feature or any
> other simple solution?
Read the docs:
https://www.pgadmin.org/docs/pgadmin4/6.19/import_export_data.html
>
> Regards
>
> Marco
>
> i.A. Dr. Marco Lechner
>
> Leiter Fachgebiet RN 1 │ Head RN 1
>
> --
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2023-01-31 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31 13:02 Download file from COPY ... TO with pgadmin Marco Lechner <mlechner@bfs.de>
2023-01-31 13:58 ` Erik Wienhold <ewie@ewie.name>
2023-01-31 16:30 ` Adrian Klaver <adrian.klaver@aklaver.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox