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

Subquery in calendar fetch incompatible with postgres

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.9.3
    • 3.9.2
    • Calendar
    • PostgreSQL
    • MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • Hide

      This can be tested with the included phpunit test on an instance using postgres. Remove the code fix part and the test will fail with a dml exception, with it, the test passes.

      Show
      This can be tested with the included phpunit test on an instance using postgres. Remove the code fix part and the test will fail with a dml exception, with it, the test passes.

      MDL-66253 made it so the raw_event_retrieval_strategy can end up making this part of it's query to fetch events:

      SELECT ev.modulename,
             ev.instance,
             ev.eventtype,
             MIN(ev.priority) as priority
      FROM ($subqueryunion) ev
      GROUP BY ev.modulename, ev.instance, ev.eventtype
      

      The problem is that it made it so $subqueryunion can just be "{event}", resulting in "FROM (mdl_event) ev". Postgres doesn't accept a table name alone as a valid subquery within the parenthesis and fails.

      This is fixed by removing the parenthesis around the table name when that's the only thing in the subqueryunion.

       

      See: https://www.postgresql.org/docs/9.5/sql-select.html

            aolley Adam Olley
            aolley Adam Olley
            Simey Lameze Simey Lameze
            Jake Dallimore Jake Dallimore
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 15 minutes
                2h 15m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.