Re: Writing triggers in C++

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>
Cc: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jacob Rief <jacob(dot)rief(at)gmx(dot)at>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Writing triggers in C++
Date: 2007-02-14 13:20:27
Message-ID: 20070214132026.GG5025@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Florian G. Pflug wrote:
> Andreas Pflug wrote:
> >Tom Lane wrote:
> >>Jacob Rief <jacob(dot)rief(at)gmx(dot)at> writes:
> >>
> >>>I tried to write a trigger using C++.
> >>>
> >>That is most likely not going to work anyway, because the backend
> >>operating environment is C not C++. If you dumb it down enough
> >>--- no exceptions, no RTTI, no use of C++ library --- then it might
> >>work,
> >I can confirm that it does work this way.
>
> I've written an aggregate function that uses c++ stl hashes, and it
> seems to work pretty well. I'd think that using exceptions should be
> fine, as long as you make sure to _always_ catch any exception that
> might be thrown inside your own c++ code, and don't let it propagate
> into backend code. STL allows you to specify custom allocator classes
> as template parameters to hash, vector and the like. You can use that
> to let STL allocate memory from the correct memory context.

What happens if Postgres raises an elog(ERROR) in the code you're
catching exceptions in? Is it propagated outwards?

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-02-14 14:09:02 Plan for compressed varlena headers
Previous Message Pavan Deolasee 2007-02-14 13:07:03 Re: HOT for PostgreSQL 8.3