Forum OpenACS Q&A: Re: content_item__delete referential integrity error

Collapse
Posted by Robert Locke on
Hi Tammy,

Sorry, meant to reply sooner.  Which version of OACS and PG are you using?  I seem to remember having this same problem in a previous version of OACS and solving it the way you did: nulling out the live/latest revision of the content item before deleting it.  Or maybe I removed all the associated revisions before calling content_item__delete.  I honestly can't remember, but you get the idea.

For the record, on my test OACS 4.6.3 (final)/PG 7.2.4 install, everything seems to work fine.  I created a content_item with 3 revisions, and was able to successfully delete it without having to do anything special:

# select live_revision, latest_revision from cr_items where item_id = 383;
live_revision | latest_revision
---------------+-----------------
          385 |            386
(1 row)

# select content_item__delete(383);
NOTICE:  Deleting symlinks...
NOTICE:  Unscheduling item...
NOTICE:  Deleting associated revisions...
NOTICE:  Deleting associated item templates...
NOTICE:  Deleting item relationships...
NOTICE:  Deleting child relationships...
NOTICE:  Deleting parent relationships...
NOTICE:  Deleting associated permissions...
NOTICE:  Deleting keyword associations...
NOTICE:  Deleting associated comments...
NOTICE:  Deleting content item...
content_item__delete
----------------------
                    0
(1 row)

# select * from cr_items where item_id = 383;
(0 rows)

Collapse
Posted by tammy m on
Thanks Robert.

I tried deleting the revisions first but that gave me more referential integrity errors...

But anyway I was able to delete in the end. Just wanted to be sure my nulling out latest revisions idea wasn't gonna bite me back one day;)

I'm on 4.6.1 and postgesql 7.2.4.

I'm loathe to upgrade to 4.6.3 cuz I had such a hard time getting my first install of OACS to work with all the packages I wanted... but I will one day;)