Jump to:

1030 Posts in 805 Topics by 311 members

Forum Module

SilverStripe Forums » Forum Module » [Solved] db error for Forum RSS feed (SS 2.3.4 and forum 0.2.4)

Discuss the Forum Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2353 Views
  • Bruce B
    Avatar
    Community Member
    145 Posts

    [Solved] db error for Forum RSS feed (SS 2.3.4 and forum 0.2.4) Link to this post

    After upgrading both SS and the forum module, I'm getting the following error repeatedly. Any suggestions?

    Couldn't run query: SELECT max(ID) as LastID, max(Created) as LastCreated FROM Post JOIN SiteTree_Live ForumPage on POST.ForumID=ForumPage.ID WHERE ForumPage.ParentID=48 Column 'ID' in field list is ambiguous
    Line 401 of MySQLDatabase.php
    MySQLDatabase->databaseError(Couldn't run query: SELECT max(ID) as LastID, max(Created) as LastCreated FROM Post JOIN SiteTree_Live ForumPage on POST.ForumID=ForumPage.ID WHERE ForumPage.ParentID=48 | Column 'ID' in field list is ambiguous,256)
    Line 102 of MySQLDatabase.php
    MySQLDatabase->query(SELECT max(ID) as LastID, max(Created) as LastCreated FROM Post JOIN SiteTree_Live ForumPage on POST.ForumID=ForumPage.ID WHERE ForumPage.ParentID=48,256)
    Line 120 of DB.php
    DB::query(SELECT max(ID) as LastID, max(Created) as LastCreated FROM Post JOIN SiteTree_Live ForumPage on POST.ForumID=ForumPage.ID WHERE ForumPage.ParentID=48)
    Line 559 of ForumHolder.php
    ForumHolder_Controller->NewPostsAvailable(,,Array)
    Line 467 of ForumHolder.php
    ForumHolder_Controller->rss(HTTPRequest)
    Line 159 of Controller.php
    Controller->handleAction(HTTPRequest)
    Line 129 of RequestHandler.php
    RequestHandler->handleRequest(HTTPRequest)
    Line 119 of Controller.php
    Controller->handleRequest(HTTPRequest)
    Line 29 of ModelAsController.php
    ModelAsController->handleRequest(HTTPRequest)
    Line 277 of Director.php
    Director::handleRequest(HTTPRequest,Session)
    Line 121 of Director.php
    Director::direct(/wamboin-noticeboards/rss)
    Line 118 of main.php

  • Bruce B
    Avatar
    Community Member
    145 Posts

    Re: [Solved] db error for Forum RSS feed (SS 2.3.4 and forum 0.2.4) Link to this post

    I'll have to write this one up as a bug in Forum 0.2.4, I think. For this site I have created a number of fields in the basic Page so I have Page, Page_Live and Page_versions tables. This means the field ID need to be written as `Post`.ID to avoid the ambiguous field error message. A couple of other fields have the same problem so line 558 of ForumHolder.php becomes:

    $version = DB::query("SELECT max(`Post`.ID) as LastID, max(`Post`.Created) " .
    "as LastCreated FROM Post JOIN " . ForumHolder::baseForumTable() . " ForumPage on `Post`.ForumID=ForumPage.ID WHERE ForumPage.ParentID={$this->ID}")->first();

    which fixes the problem.

  • Willr
    Avatar
    Forum Moderator
    5482 Posts
  • WalterW
    Avatar
    Community Member
    18 Posts

    Re: [Solved] db error for Forum RSS feed (SS 2.3.4 and forum 0.2.4) Link to this post

    There is another ambiguity! I get following DB error message:

    # Couldn't run query: SELECT `Post`.*, `Post`.ID, if(`Post`.ClassName,`Post`.ClassName,'Post') AS RecordClassName FROM `Post` JOIN SiteTree_Live ForumPage on Post.ForumID=ForumPage.ID WHERE (TopicID > 0 AND ID > 389 AND ForumPage.ParentID='69') GROUP BY `Post`.ID ORDER BY Created DESC LIMIT 50 Column 'ID' in where clause is ambiguous
    Line 401 of MySQLDatabase.php
    # MySQLDatabase->databaseError(Couldn't run query: SELECT `Post`.*, `Post`.ID, if(`Post`.ClassName,`Post`.ClassName,'Post') AS RecordClassName FROM `Post` JOIN SiteTree_Live ForumPage on Post.ForumID=ForumPage.ID WHERE (TopicID > 0 AND ID > 389 AND ForumPage.ParentID='69') GROUP BY `Post`.ID ORDER BY Created DESC LIMIT 50 | Column 'ID' in where clause is ambiguous,256)
    Line 102 of MySQLDatabase.php
    # MySQLDatabase->query(SELECT `Post`.*, `Post`.ID, if(`Post`.ClassName,`Post`.ClassName,'Post') AS RecordClassName FROM `Post` JOIN SiteTree_Live ForumPage on Post.ForumID=ForumPage.ID WHERE (TopicID > 0 AND ID > 389 AND ForumPage.ParentID='69') GROUP BY `Post`.ID ORDER BY Created DESC LIMIT 50,256)
    Line 120 of DB.php

    I changed the function RecentPosts

          if($lastPostID > 0)
             $filter .= " AND ID > $lastPostID";


    to

          if($lastPostID > 0)
             $filter .= " AND Post.ID > $lastPostID";

    Should be corrected!

    2353 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.