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


Reply via email to