Re: server-side extension in c++

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, Igor <igor(at)carcass(dot)ath(dot)cx>, pgsql-general(at)postgresql(dot)org
Subject: Re: server-side extension in c++
Date: 2010-06-01 02:55:00
Message-ID: 201006010255.o512t0w17761@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > That is great new information. I have created a new documentation
> > section called "Using C++ for Extensibility", and listed you as the
> > author in the CVS commit; patch attached. Thanks.
>
> Too bad two out of the four pieces of advice are wrong (how many pieces
> of memory managed by the backend are allocated directly with malloc?).
> The other two are not wrong as far as they go, but they're certainly
> woefully inadequate, because no interesting backend extension is going
> to be able to get along without calling back into the core code.

Good point. I assumed others would chime in to improve this.

> Personally I would reduce this section to
>
> <para>
> Don't.
> </para>
>
> I don't think it is worth our time to try to support people who run into
> the inevitable memory management and error handling incompatibilities.
> Nor are they likely to be happy at the end of the experience, if we
> blithely tell them up front that it'll work.

Well, I would have avoided this mine-trap except we have this 9.0
release note item:

Allow use of <productname>C++</> functions in backend code (Kurt
Harriman, Peter Eisentraut)

I figure if we don't provide some guidance, things will be even worse.

I have updated the docs to mention palloc/pfree instead; applied patch
attached.

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

+ None of us is going to be here forever. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 1.3 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-06-01 03:05:11 Re: server-side extension in c++
Previous Message Tom Lane 2010-06-01 02:48:11 Re: server-side extension in c++