#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)
Change History (6)
comment:1 Changed 5 years ago by anderson@…
comment:2 Changed 5 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
comment:4 Changed 4 years ago by k0s
- Resolution set to fixed
- Status changed from new to closed
comment:5 Changed 3 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].


Please include this in next releases.