Bug #23711 | #1054 - Unknown column in 'on clause' | ||
---|---|---|---|
Submitted: | 27 Oct 2006 10:16 | Modified: | 27 Oct 2006 12:55 |
Reporter: | Dan Kokenge | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Query Browser | Severity: | S1 (Critical) |
Version: | 5.0.24 | OS: | Windows (XP) |
Assigned to: | CPU Architecture: | Any |
[27 Oct 2006 10:16]
Dan Kokenge
[27 Oct 2006 11:41]
Frederic Steinfels
This bug still exists in version 5.0.26 and needs immediate fixing. Please provide me with a diff file, I'll have to make tests for you. This is my statement SELECT ps.`id`, co.`advancedoptions_id` FROM productsource AS ps, categorydefaults AS cd, categoryoptions AS co LEFT JOIN productsourceoptions AS po ON ps.`id`=po.`productsource_id` AND ps.`id`='23350' AND po.`advancedoptions_id`=co.`advancedoptions_id` WHERE ps.`sadvancedoptions`='update' AND po.`id` IS NULL AND ps.`cat1_id`=cd.`cat1` AND ps.`cat2_id`=cd.`cat2` AND cd.`id`=co.`categorydefaults_id` depending on the order of the three tables in the FROM part, I will get either ERROR 1054 (42S22): Unknown column 'co.advancedoptions_id' in 'on clause' or ERROR 1054 (42S22): Unknown column io'ps.id' in 'on clause'
[27 Oct 2006 12:29]
Dan Kokenge
Here is the diff you ask for. If you need more information - let me know. ======================================================= -- phpMyAdmin SQL Dump -- version 2.8.2.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Oct 27, 2006 at 05:26 AM -- Server version: 5.0.24 -- PHP Version: 5.1.6 -- -- Database: `maytrex_winelite` -- -- -------------------------------------------------------- -- -- Table structure for table `company` -- CREATE TABLE `company` ( `company_num` int(10) unsigned NOT NULL auto_increment, `name` varchar(40) NOT NULL default '', `addr1` varchar(22) NOT NULL default '', `addr2` varchar(22) NOT NULL default '', `city` varchar(22) NOT NULL default '', `state` char(3) NOT NULL default '', `zip` varchar(10) NOT NULL default '', `country` varchar(4) NOT NULL default 'USA', `contact` varchar(40) NOT NULL default '', `phone` varchar(17) NOT NULL default '', `fax` varchar(17) NOT NULL default '', `e_mail` varchar(50) NOT NULL default '', `grower_sw` char(1) NOT NULL default 'Y', `vendor_sw` char(1) NOT NULL default 'N', `owner_sw` char(1) NOT NULL default 'N', `ship_sw` char(1) NOT NULL default 'N', `notes` text NOT NULL, PRIMARY KEY (`company_num`), KEY `company_name` (`name`), KEY `company_zip` (`zip`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -- -- Dumping data for table `company` -- INSERT INTO `company` (`company_num`, `name`, `addr1`, `addr2`, `city`, `state`, `zip`, `country`, `contact`, `phone`, `fax`, `e_mail`, `grower_sw`, `vendor_sw`, `owner_sw`, `ship_sw`, `notes`) VALUES (1, 'Dawnridge', '2864 Dawnridge', '', 'Redding', 'CA', '96001', 'USA', 'Dan The Man', '111-222-3333', 'fax', 'dknoware@netscape.net', 'Y', 'Y', 'Y', 'Y', ''), (2, 'Dawnridge', '2864 Dawnridge', '', 'Redding', 'CA', '96001', 'USA', 'Dan The Man', '111-222-3333', 'fax', 'dknoware@netscape.net', 'Y', 'Y', 'Y', 'Y', ''), (3, 'Tetris Winery', '1234 Buger', '', 'Seattel', 'CA', '96001', 'USA', 'Ray the Pay', '111-222-3333', 'fax', 'dknoware@netscape.net', 'Y', 'Y', 'Y', 'Y', ''); -- -------------------------------------------------------- -- -- Table structure for table `wpo` -- CREATE TABLE `wpo` ( `wpo_num` decimal(6,1) unsigned NOT NULL default '0.0', `wpo_ctl` char(1) NOT NULL default 'P', `wpo_datetime` datetime NOT NULL default '0000-00-00 00:00:00', `req_user_num` int(10) unsigned NOT NULL default '0', `ent_user_num` int(10) unsigned NOT NULL default '0', `chk_user_num` int(10) unsigned NOT NULL default '0', `cmp_user_num` int(10) unsigned NOT NULL default '0', `wpo_op` char(2) NOT NULL default '', `load_cent_id` varchar(5) NOT NULL default '', `run_min` int(11) NOT NULL default '0', `num_from` tinyint(2) NOT NULL default '0', `num_to` tinyint(2) NOT NULL default '0', `contract_id` varchar(10) NOT NULL default '', `company_num` int(10) unsigned NOT NULL default '0', `gross_pay` decimal(10,2) NOT NULL default '0.00', `reward_pay` decimal(10,2) NOT NULL default '0.00', `penalty_pay` decimal(10,2) NOT NULL default '0.00', `net_pay` decimal(10,2) NOT NULL default '0.00', `notes` text NOT NULL, `user_num` int(11) NOT NULL default '0', PRIMARY KEY (`wpo_num`), UNIQUE KEY `wpo_op` (`wpo_op`,`wpo_datetime`), UNIQUE KEY `wpo_comp` (`wpo_datetime`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `wpo` -- INSERT INTO `wpo` (`wpo_num`, `wpo_ctl`, `wpo_datetime`, `req_user_num`, `ent_user_num`, `chk_user_num`, `cmp_user_num`, `wpo_op`, `load_cent_id`, `run_min`, `num_from`, `num_to`, `contract_id`, `company_num`, `gross_pay`, `reward_pay`, `penalty_pay`, `net_pay`, `notes`, `user_num`) VALUES (1.0, 'R', '2006-03-11 05:43:00', 0, 0, 0, 0, 'C', '', 19, 1, 1, 'contract_1', 1, 0.00, 0.00, 0.00, 0.00, '', 0), (2.0, 'R', '2006-03-11 05:46:00', 0, 0, 0, 0, 'C', '', 19, 1, 1, 'contract_2', 1, 0.00, 0.00, 0.00, 0.00, '', 0), (3.0, 'R', '2006-03-11 05:49:00', 0, 0, 0, 0, 'C', '', 19, 1, 1, 'contract_3', 2, 0.00, 0.00, 0.00, 0.00, '', 0), (4.0, 'R', '2006-03-11 05:50:00', 0, 0, 0, 0, 'C', '', 19, 1, 1, 'contract_4', 1, 0.00, 0.00, 0.00, 0.00, '', 0), (5.0, 'R', '2006-03-11 05:51:00', 0, 0, 0, 0, 'C', '', 19, 1, 1, 'contract_5', 1, 0.00, 0.00, 0.00, 0.00, '', 0); ======================================================== Thanks for the help.. Have a great day... Dan Kokenge
[27 Oct 2006 12:33]
Frederic Steinfels
sorry I meant the mysql developers should please speed up and release a patch (=diff) for this so I can fix this immediately.
[27 Oct 2006 12:55]
Valeriy Kravchuk
What version did you use before? Please, read the manual, http://dev.mysql.com/doc/refman/5.0/en/join.html: "Further changes in join processing were made in 5.0.12 to make MySQL more compliant with standard SQL. These charges are described later in this section. ... However, the precedence of the comma operator is less than than of INNER JOIN, CROSS JOIN, LEFT JOIN, and so on. If you mix comma joins with the other join types when there is a join condition, an error of the form Unknown column 'col_name' in 'on clause' may occur. Information about dealing with this problem is given later in this section. ... " So, it is expected and documented behaviour now. Sorry.