Forum OpenACS Q&A: Response to load-data-model errors

Collapse
Posted by Don Baccus on
OK, I've played around with Shalon's system.  He's uncovered a bug which I think is probably present in the ACS/Oracle version, too.

In his .ini file he uncommented the line:

;RequiredUserTable=users_preferences

In spam.sql, there's a trigger function on inserts into "users".  In the Oracle version, it tries to first update users_preferences() and if that fails, inserts into users_preferences.  I didn't see how to do  that easily in PL/pgSQL so I just did the insert, after checking the scripts that make a new user.  They always insert into users before touching extra tables.

When Shalon uncommented the .ini line, that caused user-new-2.tcl to do a "insert into users_preferences(user_id) values($user_id)", but the trigger mentioned above had already done an insert, thus the duplicate key error.

It sure looks to me like the Oracle version does stuff in the same order, because the script's hardwired (and I checked the current Oracle 3.2 sources and they're the same).  In other words, the genuine PL/SQL version's check to see if the entry exists in order to avoid a dupe fails, because it is called first, with the script doing its insert afterwards.

The key - "don't do that, Shalon!" :)  For now, at least - I'll enter a ticket on this.  It may be that the offending line wants to be removed altogether from the .ini/.tcl files to avoid confusing folks.