Re: Postgresql function in C++ - Mailing list pgsql-general

From Tom Lane
Subject Re: Postgresql function in C++
Date
Msg-id 20143.1101675848@sss.pgh.pa.us
Whole thread Raw
In response to Postgresql function in C++  (Jose Mendoza <unixos@prodigy.net.mx>)
List pgsql-general
Jose Mendoza <unixos@prodigy.net.mx> writes:
> I would like if it is possible to build a PostgreSQL function in C++.

You can do this to the extent that you're using C++ as "a better C".
As soon as you get into any of the interesting features of the language,
like exceptions or RTTI, you're going to have problems due to lack of
library support --- libstdc++ isn't linked into the backend.

You could force it in there if you don't mind using a custom-built
server, but I'm not sure of the potential gotchas of putting libstdc++
into the backend.  One thing I'm pretty sure will not work in any case
is C++ exceptions; the backend uses its own setjmp-based error recovery
and that's not going to play nicely with C++.

            regards, tom lane

pgsql-general by date:

Previous
From: Jose Mendoza
Date:
Subject: Retrieving values of int8 numeric field using ODBC with LInux clients.
Next
From: Tom Lane
Date:
Subject: Re: Retrieving values of int8 numeric field using ODBC with LInux clients.