Modify

Opened 14 years ago

Last modified 8 years ago

#8508 new defect

Installation fails with PostgreSQL database backend

Reported by: anonymous Owned by:
Priority: normal Component: WorkLogPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

I installed WorkLogPlugin using easy_install, edited my trac.ini to include:

worklog.* = enabled

[worklog]
timingandestimation = true

I then ran:

trac-admin /var/trac upgrade

And it failed with:

Worklog needs an upgrade
 * Upgrading Database
Creating work_log table
InternalError: current transaction is aborted, commands ignored until end of transaction block

I examined the code in api.py and traced the problem to the following section:

    def do_db_upgrade(self, db):
        # Legacy support hack (supports upgrades from revisions r2495 or before)
        if self.db_installed_version == 0:
            try:
                cursor = self.env.get_read_db().cursor()
                cursor.execute('SELECT * FROM work_log LIMIT 1')
                # We've succeeded so we actually have version 1
                self.db_installed_version = 1
            except:
                self.db_installed_version = 0

What I believe is happening is the SELECT command fails with an error. In PostgreSQL, this invalidates the transaction until a rollback is performed. There is no rollback in the code, so when the function later tries to create a table, the InternalError is generated.

I was able to work around the problem by commenting out the SELECT test and simply setting db_installed_version to zero (which works because this is a fresh install), but I don't know the whole installation workflow well enough to suggest a permanent fix. My guess is that rolling back the transaction is bad because it might undo changes done by other plugins installed at the same time. I think that you probably need to use an alternate method of determining if the table exists or not.

Attachments (0)

Change History (1)

comment:1 Changed 8 years ago by Ryan J Ollos

Owner: Colin Guthrie deleted

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.