
           delete from r5.registryerrorreturned
                  where registryerrorreturned.registry_id = $1
                  and case when $2 ~* 'C' then registryerrorreturned_upload_filename ~* 'C'
                        else registryerrorreturned_upload_filename !~* 'C'
                        end
      		     
