pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vincent Veyron <vincent.veyron@libremen.org>
To: David Gauthier <dfgpostgres@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: running \copy through perl dbi ?
Date: Sun, 10 Dec 2023 18:39:24 +0100
Message-ID: <20231210183924.196759a6e72d0dadf31cf44e@libremen.org> (raw)
In-Reply-To: <CAEs=6DmZLwYre2AF8Li0HgL8AKFG3NwAzGEonLO0TGPk2fsZdg@mail.gmail.com>
References: <CAEs=6DmZLwYre2AF8Li0HgL8AKFG3NwAzGEonLO0TGPk2fsZdg@mail.gmail.com>

On Fri, 8 Dec 2023 10:45:28 -0500
David Gauthier <dfgpostgres@gmail.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






view thread (10+ messages)  latest in thread

Message-ID: <20231210183924.196759a6e72d0dadf31cf44e@libremen.org>
Permalink:  ../20231210183924.196759a6e72d0dadf31cf44e@libremen.org/
Also on:    postgresql.org/message-id/20231210183924.196759a6e72d0dadf31cf44e@libremen.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: vincent.veyron@libremen.org, dfgpostgres@gmail.com
  Subject: Re: running \copy through perl dbi ?
  In-Reply-To: <20231210183924.196759a6e72d0dadf31cf44e@libremen.org>
  References: <CAEs=6DmZLwYre2AF8Li0HgL8AKFG3NwAzGEonLO0TGPk2fsZdg@mail.gmail.com> <20231210183924.196759a6e72d0dadf31cf44e@libremen.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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