Index: lib/questionlib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/questionlib.php,v
retrieving revision 1.221
diff -u -r1.221 questionlib.php
--- lib/questionlib.php	20 Mar 2010 22:15:58 -0000	1.221
+++ lib/questionlib.php	6 Apr 2010 11:31:50 -0000
@@ -1033,7 +1033,9 @@
 
     // The questionid field must be listed first so that it is used as the
     // array index in the array returned by $DB->get_records_sql
-    $statefields = 'n.questionid as question, s.*, n.sumpenalty, n.manualcomment, n.flagged, n.id as questionsessionid';
+    $statefields = 'n.questionid as question, s.id, s.attempt, ' .
+            's.seq_number, s.answer, s.timestamp, s.event, s.grade, s.raw_grade, ' .
+            's.penalty, n.sumpenalty, n.manualcomment, n.flagged, n.id as questionsessionid';
 
     // Load the newest states for the questions
     $sql = "SELECT $statefields
@@ -1101,8 +1103,11 @@
                 // If the new attempt is to be based on this previous attempt.
                 // Find the responses from the previous attempt and save them to the new session
 
-                // Load the last graded state for the question
-                $statefields = 'n.questionid as question, s.*, n.sumpenalty';
+                // Load the last graded state for the question. Note, $statefields is
+                // the same as above, except that we don't want n.manualcomment.
+                $statefields = 'n.questionid as question, s.id, s.attempt, ' .
+                        's.seq_number, s.answer, s.timestamp, s.event, s.grade, s.raw_grade, ' .
+                        's.penalty, n.sumpenalty';
                 $sql = "SELECT $statefields
                           FROM {question_states} s, {question_sessions} n
                          WHERE s.id = n.newest
