postgresql7.1 SELECT distinct crftd.path, crftd.storage_area_key FROM cr_files_to_delete crftd WHERE not exists ( SELECT 1 FROM cr_revisions r WHERE substring(r.content for 100) = substring(crftd.path for 100) ) select cr_scheduled_release_exec();