Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D10992E2F2A for ; Thu, 15 Nov 2007 12:56:55 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 40587-06-2 for ; Thu, 15 Nov 2007 12:56:53 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7CD872E2DBE for ; Thu, 15 Nov 2007 12:56:24 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lAFGuMbg004286; Thu, 15 Nov 2007 11:56:22 -0500 (EST) To: bert.horvath@fh-erfurt.de cc: pgsql-interfaces@postgreSQL.org Subject: Re: C-Interface Amound of Tupels in Result after COPYout In-reply-to: <473C775E.9080704@fh-erfurt.de> References: <473C3851.6060300@fh-erfurt.de> <2564.1195140420@sss.pgh.pa.us> <473C676A.2070805@fh-erfurt.de> <3440.1195143240@sss.pgh.pa.us> <473C775E.9080704@fh-erfurt.de> Comments: In-reply-to Bert Horvath message dated "Thu, 15 Nov 2007 17:44:14 +0100" Date: Thu, 15 Nov 2007 11:56:22 -0500 Message-ID: <4285.1195145782@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/10 X-Sequence-Number: 6654 Bert Horvath writes: > Small example: > create table foo(bar integer); > insert into foo values(1),(2),(3); > res = PQexec(conn, "COPY foo TO stdout;"); > if ( PQresultStatus( res ) == PGRES_COPY_OUT ) > { > printf("RowCount: "); > printf("%s\n",PQcmdTuples(res)); // this is NULL > ... Wrong result --- at that point you've only started the COPY, not completed it, so how would it know how many rows there are? You need to look at the PGRES_COMMAND_OK result after the COPY. regards, tom lane