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

From Simon Riggs
Subject Re: allowing multiple PQclear() calls
Date
Msg-id CA+U5nML7ecex7oF83HGvozc=ww97fkcUvMSv7eXYgCNx437LKQ@mail.gmail.com
Whole thread Raw
In response to Re: allowing multiple PQclear() calls  (Marko Kreen <markokr@gmail.com>)
Responses Re: allowing multiple PQclear() calls
List pgsql-hackers
On 11 December 2012 10:39, Marko Kreen <markokr@gmail.com> wrote:
> 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().

So why doesn't PQclear() do that?

Maintaining a pointer to something that no longer exists seems strange.

Under what conditions would anybody want the old pointer value after PQclear() ?

-- Simon Riggs                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: skipping context for RAISE statements - maybe obsolete?
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: allowing multiple PQclear() calls