Moodle
  1. Moodle
  2. MDL-8569

Sorting by numerical field does not work with PostgreSQL 8.1

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.6.4
    • Fix Version/s: 1.7
    • Labels:
      None
    • Environment:
      PostgreSQL 8.1
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE

      Description

      No records found when I change the view to sort records by a numerical field. I am getting this erro in the postgresql logfile:
      ===========
      2007-02-19 12:09:12 CET moodle_cz SELECTERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
      2007-02-19 12:09:12 CET moodle_cz SELECTSTATEMENT: SELECT DISTINCT r.id, r.approved, r.userid, u.firstname, u.lastname, c.content FROM mdl_data_content c,mdl_data_records r,mdl_data_content c1, mdl_user u WHERE c.recordid = r.id
      AND c.fieldid = 31
      AND r.dataid = 10
      AND r.userid = u.id
      AND c1.recordid = r.id ORDER BY CAST(c.content AS REAL) ASC , r.id ASC LIMIT 10 OFFSET 0
      ===========

      Maybe ORDER BY CAST(c.content AS REAL) causes this error?

        Gliffy Diagrams

          Activity

          Hide
          Luke Hudson added a comment -

          I've committed a patch for this into HEAD and MOODLE_16_STABLE, ...17_STABLE, and ...18_STABLE

          Show
          Luke Hudson added a comment - I've committed a patch for this into HEAD and MOODLE_16_STABLE, ...17_STABLE, and ...18_STABLE
          Hide
          Dan Poltawski added a comment -

          Resolving this as Luke fixed it many moons ago

          Show
          Dan Poltawski added a comment - Resolving this as Luke fixed it many moons ago

            People

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

              Dates

              • Created:
                Updated:
                Resolved: