recovering from interpreter db errors

4 views
Skip to first unread message

Luke Skibinski Holt

unread,
Jan 23, 2006, 7:20:16 AM1/23/06
to Django users
Is there a way within the interpreter of recovering from these sorts of
errors:

psycopg.ProgrammingError: ERROR: current transaction is aborted,
commands ignored until end of transaction block

I get them when debugging queries and something goes awry wherein I
have to restart the interpreter and import everything again. Any help?
I have no experience with psycopg ...


Luke Skibinski Holt

Kenneth Gonsalves

unread,
Jan 23, 2006, 7:33:01 AM1/23/06
to django...@googlegroups.com
On Monday 23 Jan 2006 5:50 pm, Luke Skibinski Holt wrote:
> psycopg.ProgrammingError: ERROR:  current transaction is aborted,
> commands ignored until end of transaction block

programming error means something wrong in the sql query

--
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

Andreas Stuhlmüller

unread,
Jan 23, 2006, 7:41:28 AM1/23/06
to django...@googlegroups.com
On 1/23/06, Luke Skibinski Holt <AliceViaW...@gmail.com> wrote:
>
> Is there a way within the interpreter of recovering from these sorts of
> errors:
>
> psycopg.ProgrammingError: ERROR: current transaction is aborted,
> commands ignored until end of transaction block

Execute these commands after the error occured:

>>> from django.core import db
>>> db.db.rollback()

Andreas

Luke Skibinski Holt

unread,
Jan 23, 2006, 7:53:20 AM1/23/06
to Django users
excellent - exactly what I was looking for. Thanks heaps, Andreas.


Luke Skibinski Holt

exoweb adrian

unread,
Jan 24, 2006, 5:57:12 AM1/24/06
to Django users
I do this at this start of every django interpreter session:

>>> from django.core.db import db
>>> db.cursor().close()
>>> db.connection.autocommit()

Then you don't need to do a rollback and lose your cursor every time
you get a database error.

Reply all
Reply to author
Forward
0 new messages