pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: reina_ga@hotmail.com
To: pgsql-sql@postgresql.org
Subject: Help with COPY command
Date: 6 Apr 2004 13:31:43 -0700
Message-ID: <272e4be7.0404061231.5dffc541@posting.google.com> (raw)

I'm attempting to use the COPY command through the libpq C functions.
In the psql command line editor, I'd have the following commands:

COPY testtable FROM stdin WITH DELIMITER ',';
1, 2, 'a', 3, 4
5, 6, 'b', 7, 8
9, 10, 'c', 11, 12
\.

My question is: 

Does this all have to be passed as one big command through libpq? For
example,

res = PQexec(conn, "COPY testtable FROM stdin WITH DELIMITER ',';\n",
      "1, 2, 'a', 3, 4\n5, 6, 'b', 7, 8\n9, 10, 'c', 11, 12\n\.");


Or, can it be broken up into separate lines? For example,

res = PQexec(conn, "COPY testtable FROM stdin WITH DELIMITER ',';");
res = PQexec(conn, "1, 2, 'a', 3, 4");
res = PQexec(conn, "5, 6, 'b', 7, 8");
res = PQexec(conn, "9, 10, 'c', 11, 12");
res = PQexec(conn, "\.");

-Tony



view thread (4+ messages)  latest in thread

Message-ID: <272e4be7.0404061231.5dffc541@posting.google.com>
Permalink:  ../272e4be7.0404061231.5dffc541@posting.google.com/
Also on:    postgresql.org/message-id/272e4be7.0404061231.5dffc541@posting.google.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: reina_ga@hotmail.com
  Subject: Re: Help with COPY command
  In-Reply-To: <272e4be7.0404061231.5dffc541@posting.google.com>

* 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