pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: bert.horvath@fh-erfurt.de
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: C-Interface Amound of Tupels in Result after COPYout
Date: Thu, 15 Nov 2007 11:56:22 -0500
Message-ID: <4285.1195145782@sss.pgh.pa.us> (raw)
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>

Bert Horvath <bert.horvath@fh-erfurt.de> 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



view thread (5+ messages)

Message-ID: <4285.1195145782@sss.pgh.pa.us>
Permalink:  ../4285.1195145782@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4285.1195145782@sss.pgh.pa.us

 · 

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-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bert.horvath@fh-erfurt.de
  Subject: Re: C-Interface Amound of Tupels in Result after COPYout
  In-Reply-To: <4285.1195145782@sss.pgh.pa.us>

* 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