Re: exception psycopg.Error from psycopg2 to psycopg 3

2022-02-12 Thread Karsten Hilbert
Am Fri, Feb 11, 2022 at 07:47:22PM +0100 schrieb Daniele Varrazzo: > ISTM that setting e.sqlstate = e.diag.sqlstate would be an > improvement. The docs describe indeed that sqlstate is expected to be > None on the DBAPI classes > (https://www.psycopg.org/psycopg3/docs/api/errors.html#psycopg.Error

Re: exception psycopg.Error from psycopg2 to psycopg 3

2022-02-11 Thread Paolo De Stefani
Yes perfect solution for me Thank your the lightspeed response.. Il 11/02/2022 19:47 Daniele Varrazzo ha scritto: On Fri, 11 Feb 2022 at 18:34, Paolo De Stefani wrote: Hi Paolo, Yes, I can see some inconsistency there. At the moment I suggest you use `e.diag.sqlstate`, which works as expecte

Re: exception psycopg.Error from psycopg2 to psycopg 3

2022-02-11 Thread Daniele Varrazzo
On Fri, 11 Feb 2022 at 19:47, Daniele Varrazzo wrote: > ISTM that setting e.sqlstate = e.diag.sqlstate would be an > improvement. https://github.com/psycopg/psycopg/issues/225 -- Daniele

Re: exception psycopg.Error from psycopg2 to psycopg 3

2022-02-11 Thread Daniele Varrazzo
On Fri, 11 Feb 2022 at 18:34, Paolo De Stefani wrote: Hi Paolo, Yes, I can see some inconsistency there. At the moment I suggest you use `e.diag.sqlstate`, which works as expected and is available in psycopg2 too. In [8]: try: cnn.execute(""" ...: do $$ ...: begin ...: RAI