Re: C-Interface Amound of Tupels in Result after COPYout

Tom Lane <[email protected]>
Newsgroups gmane.comp.db.postgresql.interfaces
Message-ID <[email protected]>
Bert Horvath <[email protected]> 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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.