BUG #6646: PL/Python spiexceptions raised inside Python do not include sqlstate in external code

Поиск
Список
Период
Сортировка
От steve@empiricalthought.com
Тема BUG #6646: PL/Python spiexceptions raised inside Python do not include sqlstate in external code
Дата
Msg-id E1SUjIA-0002FA-Bi@wrigleys.postgresql.org
обсуждение исходный текст
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6646
Logged by:          Steven Huwig
Email address:      steve@empiricalthought.com
PostgreSQL version: 9.1.3
Operating system:   Linux
Description:=20=20=20=20=20=20=20=20

I am trying to raise standard SQL errors from inside PL/Python code.
However, they do not work as expected. They always have sqlstate =3D XX000
instead of the appropriate sqlstate value.

create function python_exception_bug()
returns void as $$
    raise plpy.spiexceptions.InvalidParameterValue()
$$ language 'plpython3u';

create function python_exception_sql()
returns text as $$
begin
    select python_exception_bug();
    return 'cannot happen';
exception when invalid_parameter_value then
    return 'expected behavior';
when others then
    return 'this is a bug';
end
$$ language 'plpgsql';

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

Предыдущее
От: kwalbrecht@cghtech.com
Дата:
Сообщение: BUG #6644: Query give wrong results when 'is not null' is applied in where clause
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #6644: Query give wrong results when 'is not null' is applied in where clause