Re: PQdeleteTuple function in libpq - Mailing list pgsql-hackers

From Andrew Chernow
Subject Re: PQdeleteTuple function in libpq
Date
Msg-id 4DE79F23.3060204@esilo.com
Whole thread Raw
In response to Re: PQdeleteTuple function in libpq  (Andrew Chernow <ac@esilo.com>)
List pgsql-hackers
>> AC> IMHO, this should be handled by the application. You could track
>> tuples
>> AC> removed in an int[] or copy the result set into an application
>> defined
>> AC> array of C structures. I've always been under the impression that
>> AC> PGresult objects are immutable once delivered to the application.
>>
>>
>> Andrew, why we have PQmakeEmptyPGresult, PQcopyResult,
>> PQsetResultAttrs, PQsetvalue and PQresultAlloc in this case? Of course
>> there's no big deal with their absence but let's be consistent.
>>
>
> I'm not entirely sure what you are trying to do, but can't you use
> PQmakeEmptyPGresult, PQsetResultAttrs and PQsetvalue to construct a
> result that excludes the tuples you don't want followed by a
> PQclear(initial_result)?
>

Actually the best solution would be to call PQcopyResult with all 
PG_COPYRES_XXX flags enabled except PG_COPYRES_TUPLES.  Now call 
PQsetvalue for each tuple you want to add.

-- 
Andrew Chernow
eSilo, LLC
global backup
http://www.esilo.com/


pgsql-hackers by date:

Previous
From: Pavel Golub
Date:
Subject: Re: PQdeleteTuple function in libpq
Next
From: Robert Haas
Date:
Subject: Re: Bad UI design: pg_ctl and data_directory