postgresql7.1 select rm.room_id, rm.pretty_name, rm.description, rm.moderated_p, rm.active_p, rm.archive_p, acs_permission__permission_p(room_id, :user_id, 'chat_room_admin') as admin_p, acs_permission__permission_p(room_id, :user_id, 'chat_read') as user_p, (select site_node__url(site_nodes.node_id) from site_nodes where site_nodes.object_id = obj.context_id) as base_url from chat_rooms rm, acs_objects obj where rm.room_id = obj.object_id and obj.context_id = :package_id order by rm.pretty_name