846 Posts in 226 Topics by 249 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, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1749 Views |
-
[Solved] db error for Forum RSS feed (SS 2.3.4 and forum 0.2.4)

1 December 2009 at 1:29pm Last edited: 3 December 2009 7:37pm
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 -
Re: [Solved] db error for Forum RSS feed (SS 2.3.4 and forum 0.2.4)

3 December 2009 at 7:37pm
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.
-
Re: [Solved] db error for Forum RSS feed (SS 2.3.4 and forum 0.2.4)

3 December 2009 at 8:15pm
It is a bug in 0.2.4 but was fixed in trunk recently - http://open.silverstripe.org/changeset/93489/modules/forum/trunk/code
-
Re: [Solved] db error for Forum RSS feed (SS 2.3.4 and forum 0.2.4)

9 March 2010 at 9:19pm
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.phpI changed the function RecentPosts
if($lastPostID > 0)
$filter .= " AND ID > $lastPostID";
toif($lastPostID > 0)
$filter .= " AND Post.ID > $lastPostID";Should be corrected!
| 1749 Views | ||
|
Page:
1
|
Go to Top |



