postgresql7.2 select case when count(*) = 0 then true else false end from cr_items where content_type = 'content_folder' and item_id in ($item_ids) and not content_folder__is_empty(item_id)