postgresql7.1 begin survey_response__remove(:response_id); end; select survey_id, survey_response__initial_user_id(response_id) as user_id, response_id, initial_response_id from survey_responses where survey_id=:survey_id and survey_response__initial_user_id(response_id)=:user_id