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

Unable to sort by a date field at PostgreSQL - CAST() problem

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.3, 1.9
    • Fix Version/s: 1.8.6, 1.9.1
    • Labels:
      None
    • Environment:
      Reported at PostgreSQL 8.0
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      See mod/data/field/date/field.class.php :

      function get_sort_sql($fieldname) {
      return 'CAST('.$fieldname.' AS unsigned)';
      }

      This causes problem at PostgreSQL as there is no such type "unsigned": ERROR: type "unsigned" does not exist. Note that CAST() is SQL standard but the target datatype has to be known for the SQL environement.

      No records are displayed.

      Assigning this to myself as a part of my Bugathon run.

        Attachments

        1. MDL-12893.patch.txt
          2 kB
          David Mudrák (@mudrd8mz)

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            mudrd8mz David Mudrák (@mudrd8mz)
            Tester:
            David Mudrák (@mudrd8mz)
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              15/May/08