Re: libpq object hooks (libpq events) - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: libpq object hooks (libpq events)
Date
Msg-id 20080903001920.GT12610@alvh.no-ip.org
Whole thread Raw
Responses Re: libpq object hooks (libpq events)  (Andrew Chernow <ac@esilo.com>)
Re: libpq object hooks (libpq events)  (Andrew Chernow <ac@esilo.com>)
List pgsql-hackers
Andrew Chernow escribió:
> Attached is the latest patch.  It has addressed the requested changes
> found here:
> http://archives.postgresql.org/pgsql-patches/2008-05/msg00389.php
>
> Its a tarball because there are two new files, libpq-events.c and
> libpq-events.h.  The patch is in the tarball as well as attached to the
> email.

I modified this patch slightly.  I was about to try libpqtypes on it,
but then I noticed that libpqtypes as published on pgfoundry is based on
a very old version of this patch, so I punted.  So, for now, the only
guarantee is that it compiles with no warnings.

However, the only change of any significance that I introduced was that
a "name" is attached to every event proc, so that it can be reported in
error messages, as reporting only %p seems very useless.  (I also
removed PQresultAlloc.)

The API seems reasonable to me.

There's one thing that seems a bit baroque, which is the
PG_COPYRES_USE_ATTRS stuff in PQcopyResult.  I think that flag
introduces different enough behavior that it should be a routine of its
own, say PQcopyResultAttrs.  That way you would leave out the two extra
params in PQcopyResult.

Oh -- one last thing.  I am not really sure about the flags to
PQcopyResult.  Should there really be flags to _remove_ behavior,
instead of flags that add?  i.e. instead of having "0" copy everything,
and have to pass flags for things not to copy, wouldn't it be cleaner to
have 0 copy only base stuff, and require flags to copy extra things?

The main missing thing from this patch is SGML docs for the new libpq
functions.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Attachment

pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Question regarding the database page layout.
Next
From: "Brendan Jurd"
Date:
Subject: Re: What is the use of the CommitFestBlank template?