[dev] Re: [nag] nag add task failure

Eric Rostetter eric.rostetter@physics.utexas.edu
Fri, 7 Jun 2002 19:49:43 -0500


Okay, it is a very simple problem, with a simple solution. 

The problem occurs when you install an earlier version of nag and setup
the database, and then later install a new version of nag using the same
database (with the new fields added).  I did this because I'm running 
CVS RELENG_1 in production, and CVS HEAD for testing, sharing the same
database.

This happens because the older nag sql tables included a field called
task_added with the attribute "not null" on it.  The new nag version
no longer uses this field (it was removed).  So when you try to update
a task, the new version doesn't set task_added, which means postgresql 
sees the update as setting task_added to null.  But task_added is set 
"not null" so it fails...

The solution is simple.  If you just want to run the new nag versions,
then remove the column task_added from the database.  If you want to
run both, then you can try what I just tried, which is to remove the
"not null" attribute from the field, using the following sql in
psql:

update pg_attribute set attnotnull = FALSE where attname = 'task_added' and 
attrelid= (select oid from pg_class where relname = 'nag_tasks');

Maybe that will help all the people having this problem. :)

-- 
Eric Rostetter
The Department of Physics
The University of Texas at Austin

"TAD (Technology Attachment Disorder) is an unshakable, impractical devotion
to a brand, platform, product line, or programming language. It's relatively
harmless among the rank and file, but when management is afflicted the damage
can be measured in dollars. It's also contagious -- someone with sufficient
political clout can infect an entire organization."

--"Enterprise Strategies" columnist Tom Yager.