Re: [PATCHES] libpq events patch (with sgml docs)

From: Andrew Chernow <ac(at)esilo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Merlin Moncure <mmoncure(at)gmail(dot)com>
Subject: Re: [PATCHES] libpq events patch (with sgml docs)
Date: 2008-09-17 03:59:44
Message-ID: 48D080B0.6070104@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
>> It is odd. Actually, it looks like a bug to me. PQgetResult is the
>> behavior we were after, don't trigger the event if the creation
>> failed. Same thing occurs during a conn reset. Looks like PQclear
>> needs to check resultStatus before it triggers RESULTDESTROY events.
>
> If you did that, then you WOULD have a bug. Consider case where you
> successfully init two events, and the third one fails. You'll now
> change the result's status to ERROR. If you don't RESULTDESTROY
> then the first two events will leak whatever storage they allocated.
>
> The reason I suggested not being conditional about the init call was
> to reduce the probability of bugs of similar ilks associated with
> an event proc assuming that it could only get a DESTROY call for
> something it had seen CREATEd --- for example, if it were frobbing
> a reference count for some long-lived data, it could very easily
> screw up the reference count that way. I suppose that the risk of
> an earlier event proc failing means it has to cope with that case
> anyway, but I don't think it's a particularly good idea to have
> arbitrary asymmetries increasing the odds of a problem.
>
> regards, tom lane
>
>

Yeah. Good point. I fixed it to always fire events.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

Attachment Content-Type Size
libpq-events.tgz application/x-compressed 13.1 KB
libpq-events.patch text/plain 51.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-09-17 04:36:53 Re: [PATCHES] libpq events patch (with sgml docs)
Previous Message Tom Lane 2008-09-17 03:40:17 Re: [PATCHES] libpq events patch (with sgml docs)

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-09-17 04:36:53 Re: [PATCHES] libpq events patch (with sgml docs)
Previous Message Tom Lane 2008-09-17 03:40:17 Re: [PATCHES] libpq events patch (with sgml docs)