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

Comments Plugin error "Invalid column name 'timecreated'"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: Comments
    • Labels:
    • Environment:
      Moodle 2.0.2+ (Build 20110303); Windows Server 2008 R2; PHP 5.3.5; MS SQL Server 2008 R2
    • Database:
      Microsoft SQL
    • Affected Branches:
      MOODLE_20_STABLE

      Description

      New installation of Moodle 2.0.2 on Windows Server 2008/IIS7/MS SQL. Adding Comments block to main page generates "Database Error" immediately upon initial access to Moodle site; error page prevents normal login. Logging into admin page and hiding the Comments plugin bypasses problem.

      I have traced down the source of the problem to the "limit_to_top_n()" function call from sqlsrv_native_moodle_database->get_recordset_sql(). See full trace in attached file. More specifically the reference to 'timecreated' column in

      SELECT TOP 9223372036854775806 ROW_NUMBER() OVER(ORDER BY timecreated DESC) AS sqlsrvrownumber ...

      needs to use the renamed column name ctimecreated renamed later in the query

      c.timecreated AS ctimecreated

      Is this problem unique to MS SQL Server? Does MySQL allow both a reference to either the original timecreated (non qualified) and the renamed column ctimecreated?

      I have not yet attempted to decode the logic in 'limit_to_top_n'.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: