pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
COPY Question
2+ messages / 2 participants
[nested] [flat]

* COPY Question
@ 2001-04-04 21:13  John Coers <coers@intrinsity.com>
  0 siblings, 1 reply; 2+ messages in thread

From: John Coers @ 2001-04-04 21:13 UTC (permalink / raw)
  To: pgsql-docs

Hi,

I am writing a C program that accesses a 7.0.3 database using libpq.  I would like to
be able to do a fprintf through some file pointer or pipe TO the database via a PQexec call of COPY.  
I have been unable to figure out if this is possible.  I see where 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.

I see that the COPY docs mention using a pipe instead of stdin:

"stdin       Specifies that input comes from a pipe or terminal"

However, I can find no other info regarding doing a printf through a pipe directly to the db using COPY.


Is there a way to tell the COPY command to accept a file pointer or pipe or whatever other than stdin as it's input
when copying TO the db?

Thanks!
-- 
John Coers            Intrinsity, Inc.        
coers@intrinsity.com  Austin, Texas



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: COPY Question
@ 2001-04-04 22:11  Gordon A. Runkle <gar@no-spam-integrated-dynamics.com>
  parent: John Coers <coers@intrinsity.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Gordon A. Runkle @ 2001-04-04 22:11 UTC (permalink / raw)
  To: pgsql-docs

In article <3ACB8E7F.C12A50CA@intrinsity.com>, "John Coers"
<coers@intrinsity.com> wrote:

> Hi,
> 
> I am writing a C program that accesses a 7.0.3 database using libpq.  I
> would like to be able to do a fprintf through some file pointer or pipe
> TO the database via a PQexec call of COPY. I have been unable to figure
> out if this is possible.  I see where 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.

If you're on UNIX, look at the popen(3) call.

Gordon.
-- 
It doesn't get any easier, you just go faster.
   -- Greg LeMond



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-04-04 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-04-04 21:13 COPY Question John Coers <coers@intrinsity.com>
2001-04-04 22:11 ` Gordon A. Runkle <gar@no-spam-integrated-dynamics.com>

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