Moodle
  1. Moodle
  2. MDL-26066

External database enrolment sync script throws fatal error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.2
    • Component/s: Enrolments
    • Labels:
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      16041

      Description

      While working on PULL-130 test, I discovered following error. In External database enrolment setup, in Local field mapping section, I have local field 'id' selected for both user and course. I have added a single record into the external table. Then sync script throws following error:

      $ php enrol/database/cli/sync.php
      Default exception handler: Error reading from database Debug: ERROR:  invalid input syntax for integer: ""
      SELECT c.id, c.visible, c.id AS mapping
                        FROM mdl_course c
                   LEFT JOIN mdl_enrol e ON (e.courseid = c.id AND e.enrol = 'database')
                       WHERE e.id IS NULL AND c.id <> $1
      [array (
        0 => '',
      )]
      * line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
      * line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      * line 634 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      * line 328 of /enrol/database/lib.php: call to pgsql_native_moodle_database->get_recordset_sql()
      * line 47 of /enrol/database/cli/sync.php: call to enrol_database_plugin->sync_enrolments()
      

        Activity

        Hide
        Martin Dougiamas added a comment -

        Sorry Petr. All yours!

        Show
        Martin Dougiamas added a comment - Sorry Petr. All yours!
        Hide
        David Mudrak added a comment -

        Fixed and tested. Thanks Petr.

        Show
        David Mudrak added a comment - Fixed and tested. Thanks Petr.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: