Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pMr9M-0004vJ-VW for pgsql-general@arkaria.postgresql.org; Tue, 31 Jan 2023 13:58:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pMr9L-0002yL-Sr for pgsql-general@arkaria.postgresql.org; Tue, 31 Jan 2023 13:58:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pMr9L-0002yB-IY for pgsql-general@lists.postgresql.org; Tue, 31 Jan 2023 13:58:15 +0000 Received: from mout-u-204.mailbox.org ([2001:67c:2050:101:465::204]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pMr9J-0007Vp-G0 for pgsql-general@lists.postgresql.org; Tue, 31 Jan 2023 13:58:15 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4P5mpn2WSKz9sRk; Tue, 31 Jan 2023 14:58:09 +0100 (CET) Date: Tue, 31 Jan 2023 14:58:08 +0100 (CET) From: Erik Wienhold To: Marco Lechner , "pgsql-general@lists.postgresql.org" Message-ID: <264813354.7537.1675173488843@office.mailbox.org> In-Reply-To: References: Subject: Re: Download file from COPY ... TO with pgadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 31/01/2023 14:02 CET Marco Lechner wrote: > > Using COPY =E2=80=A6TO it is possible to store e.g. the =E2=80=9Cvalue=E2= =80=9D of a bytea cell in a > directory on the server. E.g. by this: > > COPY (SELECT content FROM d_doc WHERE id =3D 'x123456') TO CONCAT('/tmp/m= ydoc.pdf=E2=80=99) (FORMAT binary); > > As we do not have access to the postgresql fileserver (ssh, =E2=80=A6), b= ut can SELECT > the value of the bytea cell, is It possible to download the bytea directl= y > into a file on a client computer when using pgadmin? Is there a solution = with > the COPY =E2=80=A6 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