Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5573

SQL error (PostgreSQL) when using attempting to use a simple sorting filter in the view entries screen.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.7, 2.8.6
    • Fix Version/s: 2.8.7, 2.9.1, 3.0.4
    • Component/s: Set: Dataform
    • Labels:
      None

      Description

      To reproduce this bug, your Moodle installation needs to run on PostgreSQL database server. When creating a simple filter e.g. sort surname field alphabetically, you get an SQL error when using attempting to use the filter in the view entries screen. Please see debug info and stack trace below:

      Error reading from database

      Debug info: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
      SELECT DISTINCT e.id, e.dataid, e.state, e.timecreated, e.timemodified, e.userid, e.groupid, u.id AS uid ,u.picture,u.firstname,u.lastname,u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.imagealt,u.email,u.idnumber,u.username FROM mdl_dataform_entries e
      JOIN mdl_user u ON u.id = e.userid LEFT JOIN mdl_dataform_contents c16 ON c16.fieldid = 16 AND c16.entryid = e.id WHERE e.dataid = $1 ORDER BY c16.content ASC LIMIT 20 OFFSET 0
      [array (
      0 => '5',
      )]
      Error code: dmlreadexception
      Stack trace:
      line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 243 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 748 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 343 of /mod/dataform/classes/entry_manager.php: call to pgsql_native_moodle_database->get_records_sql()
      line 133 of /mod/dataform/classes/entry_manager.php: call to mod_dataform_entry_manager->fetch_entries()
      line 341 of /mod/dataform/classes/pluginbase/dataformview.php: call to mod_dataform_entry_manager->set_content()
      line 324 of /mod/dataform/classes/pluginbase/dataformview.php: call to mod_dataform\pluginbase\dataformview->set_entries_content()
      line 404 of /mod/dataform/classes/dataform.php: call to mod_dataform\pluginbase\dataformview->display()
      line 70 of /mod/dataform/view.php: call to mod_dataform_dataform->display()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              itamart Itamar Tzadok
              Reporter:
              majid8 Majid Hussain
              Participants:
              Component watchers:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                6/Jul/15