Re: [PATCHES] libpq type system 0.9a

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Chernow <ac(at)esilo(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Greg Sabino Mullane <greg(at)turnstep(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] libpq type system 0.9a
Date: 2008-04-09 00:06:11
Message-ID: 200804090006.m3906B619619@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> This is still 100% backwards. My idea of a libpq hook is something that
> could be used by libpgtypes *and other things*. What you are proposing
> is something where the entire API of the supposed add-on is hard-wired
> into libpq. That's just bad design, especially when the adequacy of
> the proposed API is itself in question.
>
> When I say I'd accept some hooks into libpq, I mean some hooks that
> could be used by either libpgtypes or something that would like to do
> something roughly similar but with a different API offered to clients.
> The particular hook that you seem to mostly need is the ability to
> allocate some private memory associated with a particular PGconn object,
> and maybe also with individual PGresults, and then to be able to free
> that at PQclear or PQfinish. Try designing it like that.

Agreed. A minimal change to libpq has a much better chance of being
accepted. Let me remind people that the community is not required to
accept any patch --- it is accepted based on community feedback. If we
accepted everything our API would be a mess and Postgres would be much
harder to use.

I think a wise thing would be for the patch submitters to give a _basic_
outline of what PQparam is trying to accomplish --- I mean like 10-20
lines with a code snippet, or code snippet with/withouth PQparam. Right
now there are too many people trying to guess. Of course, this should
have been done at the start. I found this posting from August, 2007 but
it isn't short/clear enough:

http://archives.postgresql.org/pgsql-hackers/2007-08/msg00630.php

I feel this API is foreign enough from what people expect from a typical
database interface library that it should be a separate library with its
own documentation, whether the library is a separate directory in core
or in pgfoundry.

FYI, it might be interesting to extend it to cover what ecpg wants ---
we have been looking for a way to get the database-dependent parts of
ecpg out of the ecpg directory and this might be a solution, _even_ if
it makes your library larger.

Again, I don't think we have trouble with another library, assuming it
does something that many people want to do and it is so tied to the
backend that it needs to be in core. (However, Tom's mention that the
OIDs don't change weakens the logic that is should be in core.)

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-04-09 00:08:26 Re: [PATCHES] libpq type system 0.9a
Previous Message Jonah H. Harris 2008-04-09 00:00:27 Setting a pre-existing index as a primary key

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-04-09 00:08:26 Re: [PATCHES] libpq type system 0.9a
Previous Message Gregory Stark 2008-04-08 23:59:49 Re: EXPLAIN progress info