Forum OpenACS Development: Response to Weird error invoking a plpgsql function (content_revision__delete)

Thanks Dan, that would be great! While you're working on that file, you might want to paste in my rewrite of the get_number function, which wasn't working at all previously:
-- function get_number
create function content_revision__get_number (integer)
returns integer as '
declare
  p_revision_id            alias for $1;  
  v_row_count              integer;
  rev_cur                  record;
begin
  v_row_count := 0;
  for rev_cur in select
                   revision_id
                 from 
                   cr_revisions r, acs_objects o
                 where
                   item_id = (select item_id from cr_revisions 
                               where revision_id = p_revision_id)
                 and
                   o.object_id = r.revision_id
                 order by
                   o.creation_date
  LOOP
    v_row_count := v_row_count + 1;
    if rev_cur.revision_id = p_revision_id then 
       return v_row_count;
    end if;
  end LOOP;

  return null; 
end;
' language 'plpgsql';