Modify

Opened 6 years ago

Closed 5 years ago

Last modified 13 months ago

#3298 closed defect (fixed)

Bug when testing if environment needs upgrade

Reported by: anderson@… Owned by: athomas
Priority: high Component: VotePlugin
Severity: blocker Keywords:
Cc: rjollos 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@… 5 years ago.
Patch file for environment upgrade

Download all attachments as: .zip

Change History (6)

comment:1 Changed 6 years ago by anderson@…

Please include this in next releases.

comment:2 Changed 6 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 5 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 5 years ago by dav.glass@…

Patch file for environment upgrade

comment:4 Changed 5 years ago by k0s

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:5 Changed 13 months ago by hasienda

  • Cc rjollos added

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].

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from athomas. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.