From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> |
Cc: | George Oakman <oakmang(at)hotmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: C++ User-defined functions |
Date: | 2009-03-10 03:19:58 |
Message-ID: | 20662.1236655198@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> writes:
> Tom Lane wrote:
>> One thing you've got to be really wary of is C++ exceptions,
>> which tend not to interoperate nicely with PG's longjmp-based error
>> handling.
> Hmm, that does sound problematic. You can always build with
> -fno-exceptions (gcc; I think other compilers offer related options) and
> adopt Pg's error handling scheme instead, though.
> In general it's possible to use exceptions in C++ code that's being
> called from C so long as you make sure you catch all possible exceptions
> at the C/C++ interface point.
The other half of the problem is that most user-written functions have
some reason to call functions in the core backend. If any of those
might throw an error then you have to do the reverse mapping too (catch
the longjmp, throw an exception, catch that back at your exit point...).
Otherwise your exception cleanup doesn't happen, which makes the whole
thing a bit useless.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2009-03-10 03:35:56 | Re: intermittant performance problem |
Previous Message | Craig Ringer | 2009-03-10 02:42:39 | Re: C++ User-defined functions |