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

Database mod search error on Postgres

XMLWordPrintable

    • PostgreSQL
    • MOODLE_16_STABLE
    • MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE

      In the view.php, creating the SQL statement it uses double-quotes as string delimiter. This is legal with MySQL, but far away any SQL standard sorridente and it does not work with Postgres too.
      The SQL syntax error can be seen enabling Debug.

      I'm referring to 2006080701 version of the module downloaded with Moodle 1.6.2+
      This is done in lines 308 and 321

      I fixed it changing these line as follows:

      line 308
      $searchselect = ' AND (c1.content LIKE \'%'.$search.'%\') ';

      line 321
      $searchselect = ' AND (c.content LIKE \'%'.$search.'%\') ';

      It have to be tested on MySQL, but should be compatible.

      ----------------8<---------------8<---------------8<---------------8<---------------8<----------------
      Actually, I slightly changed these lines also making the search case-insensitive.

      line 308
      $searchselect = ' AND ('.db_uppercase(). '(c1.content) LIKE \'%'.strtoupper($search).'%\') ';

      line 321
      $searchselect = ' AND ('.db_uppercase(). '(c.content) LIKE \'%'.strtoupper($search).'%\') ';

            skodak Petr Skoda
            nicus Lorenzo Nicora (Inactive)
            Nobody Nobody (Inactive)
            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.