Index: openacs-4/contrib/packages/survey/sql/postgresql/survey-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/sql/postgresql/Attic/survey-package-create.sql,v
diff -u -r1.1 -r1.1.2.1
--- openacs-4/contrib/packages/survey/sql/postgresql/survey-package-create.sql	19 Sep 2003 16:48:03 -0000	1.1
+++ openacs-4/contrib/packages/survey/sql/postgresql/survey-package-create.sql	13 Jan 2004 23:03:26 -0000	1.1.2.1
@@ -131,6 +131,8 @@
   remove__section_id             alias for $1;
   v_question_row         	 survey_questions%ROWTYPE;
 begin
+    delete from survey_branches where section_id=remove.section_id;
+    delete from survey_conditions where question_id in (select question_id from survey_questions where section_id=remove.section_id);
     for v_question_row in select question_id
 		from survey_questions
 		where section_id=remove__section_id
@@ -326,6 +328,8 @@
   remove__response_id           alias for $1;
   v_response_row                survey_responses%ROWTYPE;
 begin
+    delete from survey_branches where section_id in (select section_id from survey_sections where survey_id=remove.survey_id);
+    delete from survey_conditions where question_id in (select question_id from survey_questions q, survey_sections s where s.section_id=q.section_id and s.survey_id=remove.survey_id);
     for v_response_row in select response_id from survey_responses
 	where initial_response_id=remove__response_id
     loop
