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

Subquery in calendar fetch incompatible with postgres

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.9.2
    • Fix Version/s: 3.9.3
    • Component/s: Calendar
    • Labels:

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aolley Adam Olley
              Reporter:
              aolley Adam Olley
              Peer reviewer:
              Simey Lameze Simey Lameze
              Integrator:
              Jake Dallimore Jake Dallimore
              Tester:
              CiBoT CiBoT
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

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