Re: libpq PQexec call of COPY

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: John Coers <coers(at)intrinsity(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq PQexec call of COPY
Date: 2001-04-10 17:08:43
Message-ID: Pine.LNX.4.30.0104101907410.1403-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

John Coers writes:

> Hi,
>
> My generic problem is performance when copying very large amounts of data to a db from multiple clients.
>
> I am writing a C program on Linux Redhat6.2 that accesses a 7.0.3 database using libpq. I
> would like to be able to do a printf through STDOUT (or another file pointer) TO the database via a
> PQexec call of COPY. Something like this would be ideal:
>
> PQexec(conn, "COPY moncoverage from STDOUT");
>
> I have been unable to figure out if this is possible. I understand that I can do this via stdin,
> but I don't want the user to make the entry, I want the executable to do it and still enjoy the
> performance of the COPY command.

Read the libpq chapter in the Programmer's Guide and look into
src/bin/psql/copy.c for information and examples of using COPY through
libpq. Yes, it's possible, but you need to use special API calls.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Peter Peltonen 2001-04-11 09:19:25 7.1 RC4 docs look funny
Previous Message Homayoun Yousefi'zadeh 2001-04-10 17:01:54 Re: JDBC compile

Browse pgsql-hackers by date

  From Date Subject
Next Message Doug McNaught 2001-04-10 17:13:35 Re: [HACKERS] JDBC and Perl compiling problems w/ postgresql-7.1rc4
Previous Message Homayoun Yousefi'zadeh 2001-04-10 17:06:08 Re: [HACKERS] JDBC and Perl compiling problems w/ postgresql-7.1rc4