Re: allowing multiple PQclear() calls - Mailing list pgsql-hackers

From Marko Kreen
Subject Re: allowing multiple PQclear() calls
Date
Msg-id CACMqXCJVVJ_6WsOM-mo5h4tL=wYiv-qKz0k_0O+SuFhLsbp-qQ@mail.gmail.com
Whole thread Raw
In response to allowing multiple PQclear() calls  (Josh Kupershmidt <schmiddy@gmail.com>)
Responses Re: allowing multiple PQclear() calls  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On Tue, Dec 11, 2012 at 6:59 AM, Josh Kupershmidt <schmiddy@gmail.com> wrote:
> Would it be crazy to add an "already_freed" flag to the pg_result
> struct which PQclear() would set, or some equivalent safety mechanism,
> to avoid this hassle for users?

Such mechanism already exist - you just need to set
your PGresult pointer to NULL after each PQclear().

Later you can safely call PQclear() again on that pointer.

-- 
marko



pgsql-hackers by date:

Previous
From: Jeevan Chalke
Date:
Subject: Re: too much pgbench init output
Next
From: Amit Kapila
Date:
Subject: Re: Proposal for Allow postgresql.conf values to be changed via SQL