Bug #20097 Incompatibility betwen mySQL and vBulletin 3.0.7
Submitted: 26 May 2006 20:26 Modified: 26 May 2006 20:38
Reporter: path ological Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:Newest OS:Windows (WindowsXP PS2)
Assigned to: CPU Architecture:Any

[26 May 2006 20:26] path ological
Description:
I just inasalled Vbulletin version 3.0.7
I get the following problem when i click on the UserCP option.
I am using Apache2triad as my software.
I can gain access to some UserCP options but no when i click on the UserCP link. I get the follwoing error.
Below is the error i get. Below that is the propperty of the table that i have exported.

CODE
Database error

Invalid SQL:
    SELECT thread.threadid, thread.forumid
    FROM thread AS thread, subscribethread AS subscribethread
    LEFT JOIN deletionlog AS deletionlog ON(deletionlog.primaryid = thread.threadid AND type = 'thread')
    WHERE subscribethread.threadid = thread.threadid
    AND subscribethread.userid = 1
    AND thread.visible = 1
    AND lastpost > 1148663336
    AND deletionlog.primaryid IS NULL

mysql error: Unknown column 'thread.threadid' in 'on clause'

mysql error number: 1054

Date: Friday 26th 2006f May 2006 01:11:47 PM
Username: pathological
IP Address: 127.0.0.1

How to repeat:
After installing vBulletin, log in to any account. On the main page, at the top left (depending on setup and style) click on the UserCP link. This will ALWAYS cause the above link.

Suggested fix:
The following was provided by "fenway" on the apache2triad forum.

This error arises because the comma operator was used in the SELECT query. This query was not designed to work under the new MySQL 5 strict query parser, which treats commas as lower precedence than joins. Thus, it used to be that:

t1, t2 JOIN t3 ==> ( t1, t2 ) JOIN t3

But now:

t1, t2 JOIN t3 ==> t1, ( t2 JOIN t3 )

Obviously, t1 isn't part of the join, so you can't use a t1 field in the ON condition; hence the error.

I suggest you report this error to whomever supplied you with this software, or downgrade your MySQL version.

CODE
DROP TABLE IF EXISTS `thread`;
CREATE TABLE IF NOT EXISTS `thread` (
  `threadid` int(10) unsigned NOT NULL auto_increment,
  `title` varchar(250) NOT NULL default '',
  `firstpostid` int(10) unsigned NOT NULL default '0',
  `lastpost` int(10) unsigned NOT NULL default '0',
  `forumid` smallint(5) unsigned NOT NULL default '0',
  `pollid` int(10) unsigned NOT NULL default '0',
  `open` smallint(6) NOT NULL default '0',
  `replycount` int(10) unsigned NOT NULL default '0',
  `postusername` char(50) NOT NULL default '',
  `postuserid` int(10) unsigned NOT NULL default '0',
  `lastposter` char(50) NOT NULL default '',
  `dateline` int(10) unsigned NOT NULL default '0',
  `views` int(10) unsigned NOT NULL default '0',
  `iconid` smallint(5) unsigned NOT NULL default '0',
  `notes` varchar(250) NOT NULL default '',
  `visible` smallint(6) NOT NULL default '0',
  `sticky` smallint(6) NOT NULL default '0',
  `votenum` smallint(5) unsigned NOT NULL default '0',
  `votetotal` smallint(5) unsigned NOT NULL default '0',
  `attach` smallint(5) unsigned NOT NULL default '0',
  `similar` varchar(55) NOT NULL default '',
  PRIMARY KEY  (`threadid`),
  KEY `iconid` (`iconid`),
  KEY `postuserid` (`postuserid`),
  KEY `pollid` (`pollid`),
  KEY `forumid` (`forumid`,`visible`,`sticky`,`lastpost`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
[26 May 2006 20:38] Valeriy Kravchuk
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

Read the manual (http://dev.mysql.com/doc/refman/5.0/en/join.html). It is not a bug (in MySQL), but expcted and described behaviour since 5.0.12.