Moodle
  1. Moodle
  2. MDL-31628

Visit grade report get "ORA-00918: column ambiguously defined"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Labels:
    • Environment:
      Oracle 11gR2, CentOS6.2。
    • Database:
      Oracle
    • Testing Instructions:
      Hide

      Upgrade Moodle to 2.2.1, in course page, click "Grade" in "setting" menu. The backend database is oracle.

      Show
      Upgrade Moodle to 2.2.1, in course page, click "Grade" in "setting" menu. The backend database is oracle.
    • Workaround:
      Hide

      Obviously, the following code caused the error.

      code that cause error
      FROM (SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email, email
      

      There's "u.email" and "email" , field duplicated.

      Show
      Obviously, the following code caused the error. code that cause error FROM (SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email, email There's "u.email" and "email" , field duplicated.
    • Affected Branches:
      MOODLE_22_STABLE
    • Rank:
      38197

      Description

      After upgraded to 2.2.1, I get "ORA-00918: column ambiguously defined" when I visit grade report in course. The error message shows here:

      "error message"
      Debug info: ORA-00918: column ambiguously defined
      SELECT *
      FROM (SELECT u.id,u.picture,u.firstname,u.lastname,u.imagealt,u.email, email
      FROM m_user u
      JOIN (SELECT DISTINCT eu1_u.id
      FROM m_user eu1_u
      JOIN m_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id
      JOIN m_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = :o_eu1_courseid)
      WHERE eu1_u.deleted = 0 AND eu1_u.id <> :o_eu1_guestid) je ON je.id = u.id
      
      
      JOIN (
      SELECT DISTINCT ra.userid
      FROM m_role_assignments ra
      WHERE ra.roleid IN (5)
      AND ra.contextid IN (3068,10,1)
      ) rainner ON rainner.userid = u.id
      AND u.deleted = 0
      
      ORDER BY u.lastname ASC, u.firstname ASC)
      WHERE rownum <= :o_oracle_num_rows
      [array (
      'o_eu1_courseid' => '222',
      'o_eu1_guestid' => '1',
      'o_oracle_num_rows' => 100,
      )]
      Stack trace:
      
          line 394 of /lib/dml/moodle_database.php: dml_read_exception thrown
          line 268 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->query_end()
          line 1096 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
          line 388 of /grade/report/grader/lib.php: call to oci_native_moodle_database->get_records_sql()
          line 137 of /grade/report/grader/index.php: call to grade_report_grader->load_users()
      

        Issue Links

          Activity

          Hide
          Yanfei Lu added a comment -

          For now, I comment following line, solved problem temporary.

          "/grade/report/grader/lib.php line 344
                  $userfields .= get_extra_user_fields_sql($this->context);
          

          If you select some field in showuseridentity(M_CONFIG), this line will cause problem.

          Show
          Yanfei Lu added a comment - For now, I comment following line, solved problem temporary. "/grade/report/grader/lib.php line 344 $userfields .= get_extra_user_fields_sql($ this ->context); If you select some field in showuseridentity(M_CONFIG), this line will cause problem.
          Hide
          Andrew Davis added a comment -

          This may be the same issue as MDL-30776 but Id need to look closer.

          Show
          Andrew Davis added a comment - This may be the same issue as MDL-30776 but Id need to look closer.
          Hide
          Andrew Davis added a comment -

          Hello. I'm closing this as a duplicate of MDL-31804.

          Show
          Andrew Davis added a comment - Hello. I'm closing this as a duplicate of MDL-31804 .

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: