Forum OpenACS Q&A: Reassociating old comments with new static pages?

I was wondering how you would go about deleting all your static pages from the db (PG), not from the filesystem, without losing the comments on them.

Because of changes to static-pages which apparently have not been reflected in upgrade scripts I experienced weirdnesses after upgrading from 4.5b to 5.0 (and later 5.1). I thought it would be easiest to delete and scan the pages from scratch, thus giving them new page ids, and then (manually or automatically) reassociate the existing comments with the respective pages. (Changing the page ids won't break links but it's crucial that comment ids do not change)

I tried to temporarily reassociate all the comments on static pages to an arbitrary non-static-page object in the belief it was possible to "move 'em back" to the new page ids after the old page ids were deleted ... But after doing this it wasn't possible to delete the pages due to linguering references in the context_id_index belonging to the comments (it was a little while ago I tried this so I don't remember the exact details).

Any ideas would be appreciated.