Opened 16 years ago
Closed 16 years ago
#3102 closed defect (fixed)
burndown_job.py fails INSERT NULL id
Reported by: | anonymous | Owned by: | daan |
---|---|---|---|
Priority: | normal | Component: | ScrumBurndownPlugin |
Severity: | critical | Keywords: | INSERT NULL id in burndown table |
Cc: | Benoit Grégoire | Trac Release: | 0.11 |
Description
According to the definition of the burndown table, the id field cannot be null. Yet if burndown_job.py is run with an empty table, it attempts to INSERT a NULL for the id.
--- EXAMPLE ERROR ----
# python burndown_job.py /home/trac/client first run of burndown_job.py today - insert needed Traceback (most recent call last):
File "burndown_job.py", line 82, in ?
main()
File "burndown_job.py", line 76, in main
cursor.execute("INSERT INTO burndown(id,component_name, milestone_name, date, hours_remaining) "\
File "/usr/lib/python2.4/site-packages/Trac-0.11b1-py2.4.egg/trac/db/util.py", line 51, in execute
return self.cursor.execute(sql)
File "/usr/lib/python2.4/site-packages/Trac-0.11b1-py2.4.egg/trac/db/util.py", line 51, in execute
return self.cursor.execute(sql)
File "/usr/lib/python2.4/site-packages/pyPgSQL/PgSQL.py", line 3111, in execute
raise OperationalError, msg
libpq.OperationalError: ERROR: null value in column "id" violates not-null constraint
--- END EXAMPLE ERROR ---
--- CODE REFERENCE ---
burndown.py:69
sqlBurndownCreate = "CREATE TABLE burndown (" \
" id integer PRIMARY KEY NOT NULL,"\ " component_name text NOT NULL,"\ " milestone_name text NOT NULL," \ " date text,"\ " week text,"\ " year text,"\ " hours_remaining integer NOT NULL"\ ")"
burndown_job.py:73
cursor.execute("INSERT INTO burndown(id,component_name, milestone_name, date, hours_remaining) "\
" VALUES(NULL,'%s','%s','%s',%f)" % (comp[0], mile[0], today, hours))
--- END CODE REFERENCE ---
Attachments (1)
Change History (9)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
The same error is in burndown.py line 330. The id field cannot be null. The fix is the same as above.
In the UPDATE, hours_remaining is an integer field in the database, but here it is being set to a floating point.
I used
alter table burndown alter column hours_remaining type numeric(4,2);
to change the database field so it would accept a floaing value.
comment:3 Changed 16 years ago by
Cc: | Benoit Grégoire added; anonymous removed |
---|
comment:4 Changed 16 years ago by
Severity: | normal → critical |
---|
I attached a SVN diff fixing both problems. Note that I used float, and the numeric restricted to the range above caused problems. I didn't test schema upgrade, only creation.
comment:5 Changed 16 years ago by
Owner: | changed from Sam Bloomquist to daan |
---|
comment:8 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [5058]) Release of version 1.9.1 of the Trac Scrum burndown plugin. See http://stuq.nl/weblog/2008-12-25/scrum-burndown-plugin-191-released for more information.
A new version of the Scrum Burndown plugin for Trac is released, bringing compatibility for PostgreSQL, MySQL, Trac 0.11.2.1, and many bug fixes. Upgrading is recommended.
New features The Scrum burndown plugin is currently compatible and tested with Trac 0.10.5, Trac 0.11.1, Trac 0.11.2.1 Python 2.4 and Python 2.5. Additional to the previous SQLite compatibility, support for both PostgreSQL 8.3 and MySQL 5 has been added.
The following issues are fixed:
- Fixes #1462 better control of milestone: a way to ‘reset’ a milestone
- Fixes #1217 database upgrade fails after installing latest scrumburndownplugin
- Fixes #2476 Error: ‘line_graph’ is undefined - stop graph from displaying
- Fixes #1730 couldn’t upgrade
- Fixes #2729 Error while running under PostgreSQL
- Fixes #3102 burndown_job.py fails INSERT NULL id
- Fixes #1909 Overshooting estimate reduces remaining effort while ticket is open
- Fixes #1189 TracBurndown-01.05.10-py2.4.egg error
- Fixes #1800 No chart when clicking Burndown chart button.
- Fixes #4047 AttributeError: ‘NoneType’ object has no attribute ‘getValue’
- Fixes #2224 Changing ticket component causes removal from burndown
- Fixes #2562 Creating a new component breaks the burndown graphic for “All Components”
- Fixes #4222 Install fails on mysql
- Fixes #2218 ScrumBurndownPlugin, trac 0.10.4, mysql
Possible Patch: