Bug #3026 Select statement must not have only substrings
Submitted: 1 Mar 2004 12:36 Modified: 23 Nov 2005 15:56
Reporter: Matt Ryan Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Documentation Severity:S2 (Serious)
Version:3.51 OS:Windows (windows 2000)
Assigned to: Bugs System CPU Architecture:Any

[1 Mar 2004 12:36] Matt Ryan
Description:
Select statement must NOT have all substrings

odbc client will default and do select * from table then filter the results on the client end

Adding any single column without substrings causes the sql to properly add the where clause

table def
CREATE TABLE `oploc` (
  `f0_record` char(150) default NULL,
  `filename` char(3) default NULL,
  `don` char(14) default NULL,
  `date` date default NULL,
  `dic` char(3) default NULL,
  `ric_fr` char(3) default NULL,
  `supp_add` char(6) default NULL,
  `rsc` char(30) default NULL,
  KEY `don` (`don`),
  KEY `dic` (`dic`),
  KEY `ric_fr` (`ric_fr`),
  KEY `supp_add` (`supp_add`),
  KEY `rsc` (`rsc`)
) TYPE=MyISAM PACK_KEYS=1;

How to repeat:
SELECT SUBSTRING(f0_record,1,3) AS dic, 
SUBSTRING(f0_record,4,4) AS rp4_7, 
SUBSTRING(f0_record,8,15) AS nsn, 
SUBSTRING(f0_record,23,2) AS ui, 
SUBSTRING(f0_record,25,5) AS qty, 
SUBSTRING(f0_record,44,1) AS rp44 
FROM oploc WHERE don = 'blahblahblahbl'

Mysql log shows
SELECT * FROM oploc

Adding a non substring column to the select causes the sql to pass properly to mysql

SELECT SUBSTRING(f0_record,1,3) AS dic, 
SUBSTRING(f0_record,4,4) AS rp4_7, 
SUBSTRING(f0_record,8,15) AS nsn, 
SUBSTRING(f0_record,23,2) AS ui, 
SUBSTRING(f0_record,25,5) AS qty, 
don, 
SUBSTRING(f0_record,44,1) AS rp44 
FROM oploc WHERE don = 'blahblahblahbl'

I cannot get this same error using foxpro and odbc, only IIS and odbc, could be mdac issue?

Suggested fix:
update docs or bugfix
[26 Oct 2005 4:13] Peter Harvey
If this is caused by c/odbc then we need to fix it. If this is caused in MS software then we need to document it (assign to someone in the document team). Assigning to sergey for investigation.
[23 Nov 2005 15:55] Sergey Vlasenko
Test case that shows absence of a problem

Attachment: 03026.zip (application/x-zip-compressed, text), 2.13 KiB.

[23 Nov 2005 15:56] Sergey Vlasenko
Was not able to reproduce the problem with myodbc 3.51.12 & mysql 5.0