Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 663785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:31:39+00:00 2026-05-13T23:31:39+00:00

for some reason I’m experiencing the Operational Error with can’t rollback message when I

  • 0

for some reason I’m experiencing the Operational Error with “can’t rollback” message when I attempt to roll back my transaction in the following context:

try:
    cursors[instance].execute("lock revision, app, timeout IN SHARE MODE")
    cursors[instance].execute("insert into app (type, active, active_revision, contents, z) values ('session', true, %s, %s, 0) returning id", (cRevision, sessionId))
    sAppId = cursors[instance].fetchone()[0]
    cursors[instance].execute("insert into revision (app_id, type) values (%s, 'active')", (sAppId,))
    cursors[instance].execute("insert into timeout (app_id, last_seen) values (%s, now())", (sAppId,))
    connections[instance].commit()
except pgdb.DatabaseError, e:
    connections[instance].rollback()
    return "{status: 'error', errno:4, errmsg: \"%s\"}"%(str(e).replace('\"', '\\"').replace('\n', '\\n').replace('\r', '\\r'))

The driver in use is PGDB.

What is fundamentally wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:31:39+00:00Added an answer on May 13, 2026 at 11:31 pm

    What happens if you exclude the lock statement?

    This is what’s happening inside pgdb.py:

    def rollback(self):
        """Roll back to the start of any pending transaction."""
        if self._cnx:
            if self._tnx:
                self._tnx = False
                try:
                    self._cnx.source().execute("ROLLBACK")
                except Exception:
                    raise OperationalError("can't rollback")
        else:
            raise OperationalError("connection has been closed")
    

    So I suggest you replace your connections[instance].rollback() call with:

    connections[instance]._tnx = False
    connections[instance]._cnx.source().execute("ROLLBACK")
    

    to see if that gives you a more informative error message (the except clause inside pgdb is greedy).

    Also: check the Postgresql log, it will have probably logged the reason!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason I can't detect I can't set a z index for any
For some reason, I can't update the second label. I tested it by asking
For some reason if I try to display data with the following code, I
For some reason, I can not get this dialog to show up on the
For some reason, I can't get the John Resig micro template to work. I've
For some reason, my following line of code is returning a 0. int bac
For some reason I can't seem to get this particular web page's contents via
For some reason when I attempt to make a request to an Ajax.net web
For some reason beyond me I can't access the mysql server on a machine.
For some reason when I attempt to store boolean data in the Google Apps

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.