Re: running \copy through perl dbi ?

From: Vincent Veyron <vincent(dot)veyron(at)libremen(dot)org>
To: David Gauthier <dfgpostgres(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: running \copy through perl dbi ?
Date: 2023-12-10 17:39:24
Message-ID: 20231210183924.196759a6e72d0dadf31cf44e@libremen.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 8 Dec 2023 10:45:28 -0500
David Gauthier <dfgpostgres(at)gmail(dot)com> wrote:
>
> I'm trying to run a PG client side "\copy" command from a perl script. I
> tried using $dbh->do("\\copy ...") but it barffed when it saw the '\'...
> ERROR: syntax error at or near "\"
>
> I can do this with a command line approach, attaching to the DB then run
> using...

Duh! I just realized that what I proposed with system() is a command line approach.

As David Johnston mentionned, you can use the SQL COPY command.

However, you need then to deal with permissions so that the server may write the file, so I wonder what approach is cleaner?

--

Bien à vous, Vincent Veyron

https://marica.fr
Logiciel de gestion des contentieux juridiques, des contrats et des sinistres d'assurance

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vincent Veyron 2023-12-10 17:41:32 Re: running \copy through perl dbi ?
Previous Message Ron Johnson 2023-12-10 16:55:29 Re: Question on overall design