Index: openacs-4/packages/xotcl-core/tcl/cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/cr-procs.tcl,v diff -u -r1.76.2.48 -r1.76.2.49 --- openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 6 Apr 2021 09:31:32 -0000 1.76.2.48 +++ openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 6 Apr 2021 11:31:29 -0000 1.76.2.49 @@ -485,13 +485,13 @@ lappend atts i.[$slot column_name] } ::xo::db::Object::slot::context_id { - # In case we fetch the item by revision, we would get the - # item_id as contex_id and the resulting object would result - # having object_id = context_id. Make sure the context_id is - # always fetched from the item. - lappend atts { - (select context_id from acs_objects - where object_id = i.item_id) as context_id + # If we are fetching by revision_id, skip the context_id: + # for revisions, this is always the item_id and if the + # object is persisted, would be set as the context_id for + # the item. This creates a permission loop context_id = + # object_id that we have a constraint for now. + if {!$revision_id} { + lappend atts o.[$slot column_name] } } ::xo::db::Object::slot::* {