Re: Mostly Harmless: Welcoming our C++ friends

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Mostly Harmless: Welcoming our C++ friends
Дата
Msg-id 13389.1228487406@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Mostly Harmless: Welcoming our C++ friends  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> Well one thing that might be useful for a c++ procedural language would be
> catching C++ exceptions and translating them into ereports which could then be
> caught in Postgres.

> That's actually what I thought you had done but I just reread your mail and
> realized you only handled unhandled exceptions which cause the backend to die.

Well, that's too bad, because fixing the error-handling impedance
mismatch is the one thing that's been missing from every previous
proposal, and it's the one thing that might actually make C++ in the
backend useful rather than a toy.

It's possible/likely that this would be easier to do in the context of
a PL; that would at least provide a single point at which to catch
C++ exceptions and turn them into elogs.  The hard part is turning
elogs into exceptions so that errors thrown by core backend functions
that're called by the C++ code will behave as a C++ programmer would
expect.

For comparison look at the way that errors are handled in pl/perl etc.
The relatively narrow "SPI" API for calling back into the main backend
makes it somewhat sane to convert elogs into Perl errors, though it's
less efficient than one could wish.  I don't know how to scale that
solution up to the point where you could call any random internal
backend function, as Kurt seems to be hoping for.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zdenek Kotala
Дата:
Сообщение: Re: Versioned mo file installation
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Versioned mo file installation