#3298 closed defect (fixed)
Bug when testing if environment needs upgrade
Reported by: | 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)
Change History (6)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
I confirm this bug on trac 0.11 with python 2.3 and MySQL 5.0.51a-community
comment:3 Changed 16 years ago by
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 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 Changed 12 years ago by
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].
Please include this in next releases.