postgresql7.1 select fs_objects.object_id, fs_objects.mime_type, fs_objects.name, fs_objects.live_revision, fs_objects.type, fs_objects.pretty_type, to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, fs_objects.content_size, fs_objects.url, fs_objects.sort_key, -fs_objects.sort_key as sort_key_desc, fs_objects.file_upload_name, fs_objects.title, case when :folder_path is null then fs_objects.file_upload_name else :folder_path || fs_objects.file_upload_name end as file_url, case when fs_objects.last_modified >= (now() - cast('$n_past_days days' as interval)) then 1 else 0 end as new_p from fs_objects where fs_objects.parent_id = :folder_id and acs_permission__permission_p(fs_objects.object_id, :viewing_user_id, 'read') $categories_limitation $orderby postgresql8.4 select fs_objects.object_id, fs_objects.mime_type, fs_objects.name, fs_objects.live_revision, fs_objects.type, fs_objects.pretty_type, to_char(fs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, fs_objects.content_size, fs_objects.url, fs_objects.sort_key, -fs_objects.sort_key as sort_key_desc, fs_objects.file_upload_name, fs_objects.title, case when :folder_path is null then fs_objects.file_upload_name else :folder_path || fs_objects.file_upload_name end as file_url, case when fs_objects.last_modified >= (now() - cast('$n_past_days days' as interval)) then 1 else 0 end as new_p, case when fs_objects.type = 'folder' then (select description from cr_folders where folder_id = fs_objects.object_id) when fs_objects.type = 'url' then (select description from cr_extlinks where extlink_id = fs_objects.object_id) else (select description from cr_revisions where revision_id = fs_objects.live_revision) end as description from fs_objects where fs_objects.parent_id = :folder_id and acs_permission__permission_p(fs_objects.object_id, :viewing_user_id,'read') $orderby select content_item__get_path(:folder_id, :root_folder_id); and fs_objects.object_id in ( select object_id from category_object_map where category_id = :category_id )