Re: libpq object hooks (libpq events)

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Andrew Chernow <ac(at)esilo(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: libpq object hooks (libpq events)
Date: 2008-09-03 00:19:20
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Andrew Chernow escribió:
> Attached is the latest patch. It has addressed the requested changes
> found here:
> 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

Alvaro Herrera
The PostgreSQL Company - Command Prompt, Inc.

Attachment Content-Type Size
pqevents.patch text/x-diff 21.3 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Brendan Jurd 2008-09-03 00:20:14 Re: What is the use of the CommitFestBlank template?
Previous Message Gregory Stark 2008-09-02 23:25:06 Re: Question regarding the database page layout.

Browse pgsql-patches by date

  From Date Subject
Next Message Brendan Jurd 2008-09-03 02:57:28 pg_typeof() (was: Mysterious Bus Error with get_fn_expr_argtype())
Previous Message David Rowley 2008-09-02 23:19:26 Re: [HACKERS] TODO item: Implement Boyer-Moore searching (First time hacker)