Forum OpenACS Q&A: Re: Help! Object Creation Problems!

Collapse
Posted by Simon at TCB on
Hi,

Thats not a lot of information to go on but.....

99 times out of 100, when some gets this problem its usually due to simple code mistake, or a browser caching problem.

Evry object in the system is given a unique object_id and has an entry in the acs_objects table.

Very often, one writes bit of code that does something like

set new_object_id [db_nextval acs_object_id_seq]

This is done in page A lets say, that passed to some other page lets say pages B, for use in inserting at that point.

(I should add this is a bad idea, but does exist)

What that (and similar things) ultimately means is theres a chance for the browser to have cached that object_id value, so a reload, or a back button etc,,. can cause the entry to be re-used, and hence the complaint about unique key violation.

Its also worth noting that this circumstance can often be compounded by caching firewalls. Is it possible your network has such a firewall that may be caching previously used values?

Of course it may just be bad code in the package thats hanging on to an object_id and attempting to insert it again.. dunno without more detail.

Hope that helps