Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3480

Unknown column 'f.id' in 'where clause'

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      Debug info: Unknown column 'f.id' in 'where clause'

      SELECT
      f.id as f_id,f.course as f_course,f.name as f_name,f.type as f_type,f.intro as f_intro,f.ratingscale as f_ratingscale,f.ratingfrom as f_ratingfrom,f.ratinguntil as f_ratinguntil,f.grading as f_grading,f.attachmentmaxbytes as f_attachmentmaxbytes,f.reportingemail as f_reportingemail,f.subscription as f_subscription,f.feedtype as f_feedtype,f.feeditems as f_feeditems,f.maxpostsperiod as f_maxpostsperiod,f.maxpostsblock as f_maxpostsblock,f.postingfrom as f_postingfrom,f.postinguntil as f_postinguntil,f.typedata as f_typedata,f.magicnumber as f_magicnumber,f.originalcmid as f_originalcmid,f.shared as f_shared,
      cm.id as cm_id,cm.course as cm_course,cm.module as cm_module,cm.instance as cm_instance,cm.section as cm_section,cm.added as cm_added,cm.score as cm_score,cm.indent as cm_indent,cm.visible as cm_visible,cm.visibleold as cm_visibleold,cm.groupmode as cm_groupmode,cm.groupingid as cm_groupingid,cm.idnumber as cm_idnumber,cm.groupmembersonly as cm_groupmembersonly,cm.completion as cm_completion,cm.completiongradeitemnumber as cm_completiongradeitemnumber,cm.completionview as cm_completionview,cm.completionexpected as cm_completionexpected,cm.availablefrom as cm_availablefrom,cm.availableuntil as cm_availableuntil,cm.showavailability as cm_showavailability,
      c.id as c_id,c.shortname as c_shortname,c.fullname as c_fullname,
      (SELECT COUNT(1)
      FROM mdl_forumng_discussions cfd
      WHERE cfd.forumngid = f.id AND cfd.deleted = 0
      AND (
      ((cfd.timestart = 0 OR cfd.timestart <= ?)
      AND (cfd.timeend = 0 OR cfd.timeend > ?))
      OR (cfd.forumngid = ?)
      )
      ) AS f_numdiscussions,

      (SELECT
      COUNT(1)
      FROM (
      SELECT
      1

      FROM
      mdl_forumng_discussions fd
      INNER JOIN mdl_forumng_posts fplast ON fd.lastpostid = fplast.id
      INNER JOIN mdl_forumng_posts fpfirst ON fd.postid = fpfirst.id
      LEFT JOIN mdl_forumng_read fr ON fd.id = fr.discussionid AND fr.userid = ?
      WHERE
      fd.forumngid = f.id AND fplast.modified>?
      AND (
      (fd.groupid IS NULL)
      OR ((1=0))
      OR cm.groupmode = 2
      OR (fd.forumngid = ?)
      )
      AND fd.deleted = 0
      AND (
      ((fd.timestart = 0 OR fd.timestart <= ?)
      AND (fd.timeend = 0 OR fd.timeend > ?))
      OR (fd.forumngid = ?)
      )
      AND ((fplast.edituserid IS NOT NULL AND fplast.edituserid<>?)
      OR fplast.userid<>?)
      AND (fr.time IS NULL OR fplast.modified>fr.time)

      LIMIT 1) innerquery
      ) AS f_hasunreaddiscussions
      FROM
      mdl_forumng f
      INNER JOIN mdl_course_modules cm ON cm.instance = f.id
      AND cm.module = (SELECT id from mdl_modules WHERE name = 'forumng')
      INNER JOIN mdl_course c ON c.id = f.course
      WHERE
      cm.id = ?
      ORDER BY
      LOWER(f.name)
      [array (
      0 => 1329827034,
      1 => 1329827034,
      2 => '1',
      3 => '2',
      4 => 1324643034,
      5 => '1',
      6 => 1329827034,
      7 => 1329827034,
      8 => '1',
      9 => '2',
      10 => '2',
      11 => '2',
      )]
      Stack trace:
      line 391 of \lib\dml\moodle_database.php: dml_read_exception thrown
      line 790 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 3167 of \mod\forumng\mod_forumng.php: call to mysqli_native_moodle_database->get_records_sql()
      line 3046 of \mod\forumng\mod_forumng.php: call to mod_forumng::query_forums()
      line 2895 of \mod\forumng\mod_forumng.php: call to mod_forumng::query_forums()
      line 370 of \mod\forumng\lib.php: call to mod_forumng::get_course_forums()
      line 930 of \lib\modinfolib.php: call to mod_forumng_cm_info_view()
      line 960 of \lib\modinfolib.php: call to cm_info->call_mod_function()
      line 569 of \lib\modinfolib.php: call to cm_info->obtain_view_data()
      line 1484 of \course\lib.php: call to cm_info->get_extra_classes()
      line 110 of \course\format\weeks\format.php: call to print_section()
      line 240 of \course\view.php: call to require()

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: