postgresql7.1 delete from aa_test_results where testcase_id = :testcase_id delete from aa_test_final_results where testcase_id = :testcase_id insert into aa_test_results (testcase_id, package_key, test_id, timestamp, result, notes) values (:aa_testcase_id, :aa_package_key, :aa_testcase_test_id, current_timestamp, :test_result, :test_notes) insert into aa_test_final_results (testcase_id, package_key, timestamp, passes, fails) values (:aa_testcase_id, :aa_package_key, current_timestamp, :test_passes, :test_fails) select site_node__url(node_id) as url from site_nodes where object_id in (select package_id from apm_packages where package_key = :package_key) limit 1