Re: proposal: PL/Pythonu - function ereport

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: PL/Pythonu - function ereport
Дата
Msg-id CAFj8pRDwCjyw45yeZZVEH4_OcYdvwSWWuZtz=oKb934-M6rz_w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: PL/Pythonu - function ereport  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: proposal: PL/Pythonu - function ereport  (Catalin Iacob <iacobcatalin@gmail.com>)
Список pgsql-hackers
Hi


But in my opinion this discussion shouldn't really even be about
catching these things, most of the times you won't catch them and
instead you'll let them go to Postgres. The discussion should be
whether raise plpy.Error(...), plpy.raise_error, plpy.raise_info(,,,)
etc. all with keyword argument support are a good PLPython interface
to Postgres' ereport. I think they are.

I removed from previous patch all OOP related changes. New patch contains raise_xxxx functions only. This interface is new generation of previous functions: info, notice, warning, error with keyword parameters interface. I didn't changed older functions due keeping compatibility.

I spent lot of time with experiments how to merge PostgreSQL exception system with Python exception system. But I didn't find a solution without some design issues. These concepts(s) are too different (note: there are two concepts: PostgreSQL levels and ANSI SQL SQLSTATE (class, subclass codes).

I hope so raise_xxxx has benefit for PLPythonu users too. Currently users has to use ugly workaround to raise rich PostgreSQL exception from Python. With new function all available functionality related to PostgreSQL exception can be used simply.

plpy.raise_warning("some doesn't work", detail = "user registration ... ")

This patch is reduced previous patch (no new features, no different solution, no different code), so I use same entry in commitfest.

Regards

Pavel



Вложения

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

Предыдущее
От: Yury Zhuravlev
Дата:
Сообщение: Re: Proposal:Use PGDLLEXPORT for libpq
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Proposal:Use PGDLLEXPORT for libpq