Re: Issues with C++ exception handling in an FDW - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Issues with C++ exception handling in an FDW
Date
Msg-id CAEYLb_WCA-mgRQxGZ3nJXf0jYiFGEmBG=6SwY0QpCk08t8krew@mail.gmail.com
Whole thread Raw
In response to Issues with C++ exception handling in an FDW  ("Soules, Craig" <craig.soules@hp.com>)
Responses Re: Issues with C++ exception handling in an FDW  (Andres Freund <andres@anarazel.de>)
Re: Issues with C++ exception handling in an FDW  ("Soules, Craig" <craig.soules@hp.com>)
List pgsql-hackers
On 30 January 2012 23:04, Soules, Craig <craig.soules@hp.com> wrote:
> When there are no errors everything works flawlessly, however, we noticed that even throwing an exception in the C++
layerwas causing an immediate segmentation fault.  Even when encapsulated in a try { } catch(...) { } block. 
>
> If anyone has seen anything like this, any pointers or suggestions would be much appreciated.  I have followed all of
therecommendations in the PostgreSQL documentation, with no luck.  I am not overloading the _init() functions in either
sharedlibrary (another potential source of errors I have read about). 

I suggest that you generalise from the example of PLV8. The basic
problem is that the effect of longjmp()ing over an area of the stack
with a C++ non-POD type is undefined. I don't think you can even use
structs, as they have implicit destructors in C++.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: JSON for PG 9.2
Next
From: Robert Haas
Date:
Subject: Re: pgsql_fdw, FDW for PostgreSQL server