postgresql7.1 select 1 where exists (select name from cr_items where parent_id = :parent_folder_id and name = :encoded_filename) select file_storage__new_file ( :encoded_filename, :parent_folder_id, :user_id, :creation_ip, :indb_p, :file_id ); select file_storage__new_version ( :title, :description, :mime_type, :file_id, :user_id, :creation_ip ); update cr_revisions set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] where revision_id = :revision_id update cr_revisions set content_length = lob_length(lob) where revision_id = :revision_id select content_item__relate( :homework_file_id, :correction_file_id, 'homework_correction', null, 'cr_item_rel' );