Subject: C-Interface Amound of Tupels in Result after COPYout
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/15/2007 11:14:00 AM
Bert Horvath <bert.horvath@fh-erfurt.de> writes:
> Tom Lane schrieb:
>> PQcmdTuples. PQnTuples is for the number of rows actually returned to
>> the client by a SELECT.
> i have allready tryed out this it allways returns 0...
Try a more recent release.
[ checks code... ] Looks like the count was added to COPY's command
status in 8.2.
regards, tom lane
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
Subject: C-Interface Amound of Tupels in Result after COPYout
From: tgl@sss.pgh.pa.us (Tom Lane)
Date: 11/15/2007 11:56:22 AM
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
---------------------------(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
|