Modify

Opened 9 years ago

Closed 8 years ago

Last modified 5 years ago

#3298 closed defect (fixed)

Bug when testing if environment needs upgrade

Reported by: anderson@… Owned by: Alec Thomas
Priority: high Component: VotePlugin
Severity: blocker Keywords:
Cc: Ryan J Ollos Trac Release: 0.11

Description

Hi,

I detected an bug when the plug-in tests if the environment needs upgrade. It counts how much items there are on the table votes. But, at least on MySQL, if there is no records, it don´t returns nothing. So commented the line above and everything worked great. If don´t do it, the trac always says that the database needs an upgrade.

Just one line commented on init.py:

def environment_needs_upgrade(self, db):

cursor = db.cursor() try:

cursor.execute("SELECT COUNT(*) FROM votes") #cursor.fetchone() return False

except:

return True

Attachments (1)

upgrade.patch (450 bytes) - added by Dav Glass 9 years ago.
Patch file for environment upgrade

Download all attachments as: .zip

Change History (6)

comment:1 Changed 9 years ago by anderson@…

Please include this in next releases.

comment:2 Changed 9 years ago by daniele.domenichelli@…

I confirm this bug on trac 0.11 with python 2.3 and MySQL 5.0.51a-community

comment:3 Changed 9 years ago by Dav Glass

The actual problem is that MySQL is case sensitive. This code should make it work properly (attaching a patch file too):

    cursor.execute("select count(*) from votes")
    cursor.fetchone() return False

Changed 9 years ago by Dav Glass

Attachment: upgrade.patch added

Patch file for environment upgrade

comment:4 Changed 8 years ago by Jeff Hammel

Resolution: fixed
Status: newclosed

(In [6409]) fixes #3808; fixes #3298

comment:5 Changed 5 years ago by Steffen Hoffmann

Cc: Ryan J Ollos added; anonymous removed

For what its worth the original way of testing for db table existence was insane, causing issues for PostgreSQL too. A real fix has been applied now with [12773].

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alec Thomas.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.