Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-14564

Error thrown when submitting assignment feedback due to notnull field requirement (PostgreSQL)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.8.6, 1.9.1
    • 1.8.4
    • Assignment (2.2)
    • None
    • PostgreSQL
    • MOODLE_18_STABLE
    • MOODLE_18_STABLE, MOODLE_19_STABLE

      This problem occurred on my university's Moodle 1.8.4 installation, when a teacher was using the assignment module in offline assignment mode. The error causes the process to die leaving the teacher with a white screen. We are using POSTGRE for the DB. This only occurs when the comments are hidden.

      INSERT INTO fails because the statement does not contain the "submissioncomment" field when the field is required to have a non-null value. As mentioned in MDL-14536, it seems the MySQL in non-strict mode ignores this error, but not so with PO.STGR

      Error when comments hidden
      <2008-04-25 15:11:54 JST moodle moodle2008 20521>LOG: statement: INSERT INTO mdl_assignment_submissions ( ID, ASSIGNMENT, USERID, TIMECREATED, TIMEMODIFIED, NUMFILES, DATA1, DATA2, GRADE, FORMAT, TEACHER, TIMEMARKED, MAILED ) VALUES ( 4388, 248, 879, 1209103914, 1209103914, 0, '', '', 2, 0, 14149, 1209103914, 0 )
      <2008-04-25 15:11:54 JST moodle moodle2008 20521>ERROR: null value in column "submissioncomment" violates not-null constraint
      <2008-04-25 15:11:54 JST moodle moodle2008 20521>STATEMENT: INSERT INTO mdl_assignment_submissions ( ID, ASSIGNMENT, USERID, TIMECREATED, TIMEMODIFIED, NUMFILES, DATA1, DATA2, GRADE, FORMAT, TEACHER, TIMEMARKED, MAILED ) VALUES ( 4388, 248, 879, 1209103914, 1209103914, 0, '', '', 2, 0, 14149, 1209103914, 0 )

      Normal operation (With comments displayed)
      <2008-04-25 15:14:09 JST moodle moodle2008 20532>LOG: statement: INSERT INTO mdl_assignment_submissions ( ID, ASSIGNMENT, USERID, TIMECREATED, TIMEMODIFIED, NUMFILES, DATA1, DATA2, GRADE, SUBMISSIONCOMMENT, FORMAT, TEACHER, TIMEMARKED, MAILED ) VALUES ( 4390, 248, 998, 1209104049, 1209104049, 0, '','', 1, '', 0, 14149, 1209104049, 0 )
      <2008-04-25 15:14:09 JST moodle moodle2008 20532>LOG: statement: INSERT INTO mdl_log (time, userid, course, ip, module, cmid, action, url, info)
      VALUES ('1209104049', '14149', '3103', '133.101.114.37', 'assignment', '2803', 'update grades', 'submissions.php?id=248&user=998', '998')

      It is not clear to my why the DB requires the submissioncomment field to be non-null when this field is frequently left blank by instructors. Without inspecting the code carefully, my guess is that coders have been required to ensure that something, such as a space has been added to this field in order to prevent the DB from throwing an error, or it could simply be that developers using MySQL have not encountered the error because MySQL is more permissive in this respect.

      As suggested by Eloy in MDL-14536 it would be good to modify all DB parameters so that TEXT fields are allowed to be NULL when it makes sense to allow them to be so. Should we at our university just change the setting for the submisssioncomment field to NULL in order to work around this error?

            mudrd8mz David Mudrák (@mudrd8mz)
            trobb Thomas Robb
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.