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