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

One strange query...breaks Oracle

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.7
    • 1.7
    • Forum
    • None
    • Any, with Oracle
    • PostgreSQL, Microsoft SQL, Oracle
    • MOODLE_17_STABLE
    • MOODLE_17_STABLE

      I was testing 1.7 agaisnt different DBs when I've found this query:

      SELECT DISTINCT(p.id), p.*, d.forum, u.firstname, u.lastname, u.email, u.picture
      FROM m_forum_posts p, m_forum_discussions d, m_user u
      WHERE ... ... ...
      ORDER BY p.modified DESC

      The list of fields in the SELECT clause seems to be really crazy, with one DISTINCT being applied to only one field (p.id) and, then, again, all the fields of p (p.*).

      I'm pretty sure that such syntax isn't correct at all. I only have tested it against Oracle and ir crash! My suggestion, if there isn't any good reason for the current syntax is to simply change it to:

      SELECT p.*, d.forum, u.firstname, u.lastname, u.email, u.picture
      FROM m_forum_posts p, m_forum_discussions d, m_user u
      WHERE ... ... ...
      ORDER BY p.modified DESC

      Not need to specify the DISTINCT at all, because ADOdb will guarantee unique values for the 1st field on each query.

            dougiamas Martin Dougiamas
            stronk7 Eloy Lafuente (stronk7)
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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