Forum OpenACS Development: Re: acs_objects_context_object_un

Collapse
Posted by Nis Jørgensen on
I believe you are shooting the messenger here ... my guess is that PG checks the constraints in an unspecified order , so if you try to insert an object using an existing object_id, sometimes you will get an error from this constraint, sometimes from the pk one.

In fact, when I said that we are seeing "the same problem", I forgot to check whether it was the exact same constraint being violated - and indeed it wasn't.

It is consistent with the behavior I observe that the only difference between having a UNIQUE index and a UNIQUE constraint is in how you create/drop them, and how they show up in listings.

Now, I don't know whether we actually need a unique index. Normally this would be used for a foreign key, but I don't see any in my installation. As you point out, the constraint is logically redundant, so a simple index would make for less clutter.

/Nis