pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Chernow <ac@esilo.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@commandprompt.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Merlin Moncure <mmoncure@gmail.com>
Subject: Re: [PATCHES] libpq events patch (with sgml docs)
Date: Tue, 16 Sep 2008 23:00:51 -0400
Message-ID: <48D072E3.6010703@esilo.com> (raw)
In-Reply-To: <27615.1221619326@sss.pgh.pa.us>
References: <48C18533.2000204@esilo.com>
	<20080905192215.GK4353@alvh.no-ip.org>
	<48C18B48.509@esilo.com>
	<20080905194853.GL4353@alvh.no-ip.org>
	<48C191A7.3000205@esilo.com>
	<20080905201504.GM4353@alvh.no-ip.org>
	<48C19759.90402@esilo.com>
	<27615.1221619326@sss.pgh.pa.us>

Tom Lane wrote:
> Andrew Chernow <ac@esilo.com> writes:
>> Missed that one.  Good catch :)  Update attached.
> 
> Looking at this now.  Question: why does PQgetResult invoke the
> RESULTCREATE event only for non-error results?  

It didn't seem useful to have the eventproc implementation allocate its private 
storage (or do whatever prep work it does), just to have it PQclear'd once the 
user gets the dead result back.  I guess we figured an error result typically 
has a short life-span, not very useful outside of indicating an error.

Is there a use case you think requires the opposite behavior?

> odd asymmetry, particularly in view of the fact that a RESULTDESTROY
> event will occur for error results.  And surely we do not need to
> micro-optimize error cases for speed.
> 

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.

But before I fix this and put a patch up, please let me know if you prefer the 
opposite behavior ... trigger events on success or failure (including connreset).

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



view thread (31+ messages)  latest in thread

Message-ID: <48D072E3.6010703@esilo.com>
Permalink:  ../48D072E3.6010703@esilo.com/
Also on:    postgresql.org/message-id/48D072E3.6010703@esilo.com

 · 

reply

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: ac@esilo.com, tgl@sss.pgh.pa.us, alvherre@commandprompt.com, pgsql-hackers@postgresql.org, mmoncure@gmail.com
  Subject: Re: [PATCHES] libpq events patch (with sgml docs)
  In-Reply-To: <48D072E3.6010703@esilo.com>

* 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