Re: running \copy through perl dbi ?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: David Gauthier <dfgpostgres(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: running \copy through perl dbi ?
Date: 2023-12-08 16:05:49
Message-ID: CAKFQuwZZ9DdXsuzqqFn-jO9aUs1Zv+Z=mHsJMnXoHB+fW-eYDg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Dec 8, 2023 at 9:01 AM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 12/8/23 07:45, David Gauthier wrote:
> > Hi:
> >
> > 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...
> > -c "\copy ...". But I was wondering if there is a more elegant way to
> > do this, maybe some sort of legal SQL command that Perl/DBI would
> > swallow ???
>
> Per David Johnston post:
>
> https://metacpan.org/pod/DBD::Pg#COPY-support
>
>
Right. Since the copy api isn't really a standard thing in the SQL world
you cannot usually use generic database APIs, you need to use
driver-specific interfaces.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message peter.borissow@kartographia.com 2023-12-08 18:03:58 Inserting into foreign table with sequences and default values
Previous Message Adrian Klaver 2023-12-08 16:01:37 Re: running \copy through perl dbi ?