Raise a psycopg error with a specific pgcode #1777
Answered
by
dvarrazzo
arjenzorgdoc
asked this question in
Q&A
-
For some tests I tried to raise a psycopg2 error with a specific How do I do that? |
Beta Was this translation helpful? Give feedback.
Answered by
dvarrazzo
Mar 21, 2025
Replies: 1 comment 3 replies
-
Maybe using |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then maybe it's not possible because in psycopg2 database errors are only expected to be raised from C and the attribute is read-only from Python.
In psycopg 3 what you want to do is not a problem: