X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1CE60D1D085 for ; Wed, 14 Apr 2004 09:51:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 02915-02 for ; Wed, 14 Apr 2004 09:51:40 -0300 (ADT) Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by svr1.postgresql.org (Postfix) with SMTP id E6AB5D1CCB0 for ; Wed, 14 Apr 2004 09:51:34 -0300 (ADT) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Wed Apr 14 14:51:33 2004 +0200 Received: œby rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id OAA15527; Wed, 14 Apr 2004 14:51:32 +0200 (METDST) From: Christoph Haller Message-Id: <200404141251.OAA21416@rodos> Subject: Re: Bulk updates/inserts To: alyandon@yahoo.com (Shelby Cain) Date: Wed, 14 Apr 2004 14:51:31 METDST Cc: pgsql-interfaces@postgresql.org In-Reply-To: <20040402164234.67207.qmail@web41601.mail.yahoo.com>; from "Shelby Cain" at Apr 2, 104 7:42 pm X-Mailer: Elm [revision: 212.4] X-Virus-Scanned: by amavisd-new at postgresql.org X-Amavis-Alert: BAD HEADER Non-encoded 8-bit data (char 9C hex) in message header 'Received' Received: \234by rodos.fzk.de... ^ X-Archive-Number: 200404/27 X-Sequence-Number: 4848 > > Is it currently possible to perform bulk > updates/inserts via host arrays using ecpg? If so, > would someone mind showing me an example of the proper > syntax as I can't seem to come up with something that > the ecpg preprocessor likes. > > On a side note, if ecpg doesn't support bulk > inserts/updates are there any plans for adding such > support? Is there anyway programmatically to get > close to the same speed for inserts/updates as say the > COPY command? > > Regards, > > Shelby Cain > > __________________________________ Doing bulk inserts via host arrays is not possible AFAICT. I posted a similar request in February 2003. See http://archives.postgresql.org/pgsql-interfaces/2003-02/msg00091.php BTW, I don't see how a bulk update could be done. There is a way to use COPY programmatically via libpq: something like ... PQexec("COPY xxx FROM stdin"); for (...) { sprintf(buf, "%d\t%d\t...\n", values[0], values[1], ... values[n]); PQputline(conn, buf); } PQputline(conn, "\\.\n"); PQendcopy(conn); Regards, Christoph