exception psycopg.Error from psycopg2 to psycopg 3

Поиск
Список
Период
Сортировка
От Paolo De Stefani
Тема exception psycopg.Error from psycopg2 to psycopg 3
Дата
Msg-id 11dedb1fce0dbbd6f125736347685fd5@paolodestefani.it
обсуждение исходный текст
Ответы Re: exception psycopg.Error from psycopg2 to psycopg 3
Список psycopg
Hi all

Porting my program from psycopg2 to psycopg 3 i found another different 
behaviour

This SQL code inside a function:

RAISE EXCEPTION 'Error wrong database' USING HINT = 'You need to use a 
different database', ERRCODE = 'PA002';

is catched in python code with:

try:
    <execute sql function>
except psycopg.Error as er:
     raise PyAppDBError(er.sqlstate, er)

With psycopg2 er.sqlstate is set to 'PA002' in psycopg3 is set to None

Is this an expected behavour ? Is there a way to get the error code in 
psycopg3 like it is available in psycopg2 ?
Or maybe Am I doing something wrong ?

Thanks


-- 
Paolo De Stefani



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

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: psycopg-pool 3.1 released
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Re: exception psycopg.Error from psycopg2 to psycopg 3