Moodle
  1. Moodle
  2. MDL-40120

Issue with Postgresql and retrieves number of records from course table

    Details

    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      Needs to be tested on PostgreSQL database

      1. Enable 'List of categories' from Front page items when logged in under Front page settings / ► Edit settings.
      2. Verify the front page and bottom section broken now.
      3. Apply the fix and verify all okay.
      Show
      Needs to be tested on PostgreSQL database Enable 'List of categories' from Front page items when logged in under Front page settings / ► Edit settings. Verify the front page and bottom section broken now. Apply the fix and verify all okay.
    • Workaround:
      Hide

      Remove 'List of categories' from Front page items when logged in under Front page settings / ► Edit settings

      Show
      Remove 'List of categories' from Front page items when logged in under Front page settings / ► Edit settings
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      mdl40120-master

      Description

      When I upgraded to 2.5 from 1.9 via 2.2 I found that the front page was showing this error where the course categories are listed :-

      Default exception handler: Error reading from database Debug:
      ERROR: syntax error at or near "hassummary" at character 116
      SELECT c.id,c.category,c.sortorder,c.shortname,c.fullname,c.idnumber,c.startdate,c.visible,SUBSTR(c.summary, 1, 1) hassummary, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance
      FROM mdl_course c
      JOIN mdl_context ctx ON c.id = ctx.instanceid AND ctx.contextlevel = $1
      WHERE c.id <> $2 AND c.category = $3 ORDER BY c.sortorder
      [array (
      0 => 50,
      1 => '1',
      2 => '11',
      )]
      Error code: dmlreadexception

      • line 423 of /lib/dml/moodle_database.php: dml_read_exception thrown
      • line 288 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      • line 800 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      • line 843 of /lib/coursecatlib.php: call to pgsql_native_moodle_database->get_records_sql()
      • line 1260 of /lib/coursecatlib.php: call to coursecat::get_course_records()
      • line 1295 of /lib/coursecatlib.php: call to coursecat->get_courses()
      • line 1452 of /course/renderer.php: call to coursecat->get_courses_count()
      • line 1348 of /course/renderer.php: call to core_course_renderer->coursecat_category()
      • line 1375 of /course/renderer.php: call to core_course_renderer->coursecat_subcategories()
      • line 1477 of /course/renderer.php: call to core_course_renderer->coursecat_category_content()
      • line 1933 of /course/renderer.php: call to core_course_renderer->coursecat_tree()
      • line 254 of /index.php: call to core_course_renderer->frontpage_categories_list()
        , referer: http://localhost/admin/settings.php?section=debugging

        Gliffy Diagrams

          Activity

          Hide
          Marina Glancy added a comment -

          awesome Tim, thanks for spotting it and providing a patch

          Show
          Marina Glancy added a comment - awesome Tim, thanks for spotting it and providing a patch
          Hide
          Sam Hemelryk added a comment -

          Thanks guys, this has been integrated now.

          Show
          Sam Hemelryk added a comment - Thanks guys, this has been integrated now.
          Hide
          Michael de Raadt added a comment -

          Wow! You guys don't muck around. Well done.

          Show
          Michael de Raadt added a comment - Wow! You guys don't muck around. Well done.
          Hide
          Tim Lock added a comment -

          Only applies to psql 8.3. Thanks

          Show
          Tim Lock added a comment - Only applies to psql 8.3. Thanks
          Hide
          Damyon Wiese added a comment -

          Test passed - i tested on postgres 8.4, 9 and oracle and never got an error (with or without this patch). Note - the error on 8.3 with table aliases is known and this patch is simple and correct - so I'm going to give up on trying to install 8.3 to prove the issue that we already know about. Note: IMO we should drop support for 8.3 in this cycle because it is unsupported by postgres themselves already.

          Show
          Damyon Wiese added a comment - Test passed - i tested on postgres 8.4, 9 and oracle and never got an error (with or without this patch). Note - the error on 8.3 with table aliases is known and this patch is simple and correct - so I'm going to give up on trying to install 8.3 to prove the issue that we already know about. Note: IMO we should drop support for 8.3 in this cycle because it is unsupported by postgres themselves already.
          Hide
          Marina Glancy added a comment -

          Thanks for your awesome work! This has now become a part of Moodle.

          Closing as fixed!

          Show
          Marina Glancy added a comment - Thanks for your awesome work! This has now become a part of Moodle. Closing as fixed!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: