From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Alvaro Herrera <alvherre@commandprompt.com>
Cc: Patches (PostgreSQL) <pgsql-patches@postgresql.org>
Cc: Andrew Chernow <ac@esilo.com>
Subject: Re: libpq object hooks
Date: Fri, 16 May 2008 22:19:19 -0400
Message-ID: <18090.1210990759@sss.pgh.pa.us> (raw)
In-Reply-To: <b42b73150805161438y2c6d4373sb036d0ed649ddf88@mail.gmail.com>
References: <b42b73150804301323i18b00019i62e765708abb65aa@mail.gmail.com>
<9458.1210875556@sss.pgh.pa.us>
<482C82BA.3090100@esilo.com>
<9867.1210877054@sss.pgh.pa.us>
<482CD76E.6000202@esilo.com>
<b42b73150805160628y3c175608hc383187951206448@mail.gmail.com>
<17177.1210949948@sss.pgh.pa.us>
<482DD3AC.9020207@esilo.com>
<b42b73150805161249wb67b065le957ef1c0cdaefec@mail.gmail.com>
<20531.1210969396@sss.pgh.pa.us>
<b42b73150805161438y2c6d4373sb036d0ed649ddf88@mail.gmail.com>
"Merlin Moncure" <mmoncure@gmail.com> writes:
> On Fri, May 16, 2008 at 4:23 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> So you're imagining that on creation of a PGconn or PGresult, the
>> hook function would be allowed to create some storage and libpq would
>> then be responsible for tracking that storage? Okay, but that's a
>> separate feature from the sort of passthrough I had in mind. Where
>> exactly does the hook hand off the storage pointer to libpq? What
>> are you going to do if the hook fails to create the storage
>> (ie, out of memory during PGresult creation)?
> Right, this could happen for one of two likely reasons: OOM as you
> suggest or the callback fails for some reason only known to the
> hooking library. In either case, the callback would set the return
> pointer as defined by the structure to null, return FALSE, and libpq
> would not add the state to the array of 'event state datas' it
> maintains.
So at that point we have an apparently-successful creation of a
PGresult, but some of the hook library's functionality is going to fail
to work with that PGresult. That doesn't seem very nice. ISTM the hook
ought to be able to request that libpq return an out-of-memory failure
for the query, just as would happen if the malloc failure had happened
directly to libpq.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-patches@postgresql.org
Cc: tgl@sss.pgh.pa.us, mmoncure@gmail.com, andrew@dunslane.net, alvherre@commandprompt.com, ac@esilo.com
Subject: Re: libpq object hooks
In-Reply-To: <18090.1210990759@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox