Bug #9539 SQLColumns returns empty set for tables having sql reserved word as column name
Submitted: 31 Mar 2005 19:42 Modified: 28 Apr 2005 1:20
Reporter: Philippe Roussel Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:MyODBC 3.51.11 OS:Windows (Windows XP Pro SP2)
Assigned to: Dean Ellis CPU Architecture:Any

[31 Mar 2005 19:42] Philippe Roussel
Description:
Using MySQL database you can create tables, and use for column names a sql reserved word (examples : 'Precision', 'GROUP' ) for that you need to add backquotes;

However for such a table the ODBC driver fails to retrieve the table structure / description :
the SQLColumns function will return an empty set

How to repeat:
CREATE TABLE MX (
  ID int(11) NOT NULL auto_increment,
  `Precision` varchar(10) default NULL,
  UNIQUE KEY `ID` (`ID`)
);

CREATE TABLE MY (
  ID int(11) NOT NULL auto_increment,
  `Enfer` varchar(10) default NULL,
  UNIQUE KEY `ID` (`ID`)
);

You can retrieve table description for table MY, but not for table MX because 'Precision' is a SQL reserved word

Suggested fix:
I guess the MyODBC implementation of SQLColumns is issuing SQL queries to the MySQL database, maybe some backquotes are missing ?
[1 Apr 2005 8:46] Philippe Roussel
Server version is 5.0.0-alpha
[6 Apr 2005 6:45] Jorge del Conde
Verified w/imyodbc.exe
[6 Apr 2005 18:38] Dean Ellis
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Fixed in 3.51.12.
[11 Apr 2005 10:53] Sledge Hammer
When will the next MyODBC version (as You say, 3.51.12) be available?
Where can I find relevant information about future release exact/preliminary dates? It is very important..
[11 Apr 2005 21:37] Dean Ellis
A release date has not been established for 3.51.12; the fix is however available in source (and you can simply not use reserved words as column names), so you can build it from the souce if you need it in the immediate future.
[12 Apr 2005 8:28] Sledge Hammer
Alas, it's not me, who needs immediate build. It's our product, which's installation will not be shipped with myodbc (users will have to download the lastest <working> version).
v3.51.11 is no good because of the bug #5681. [so are all MyODBCs down to v3.51.06 :(, which in respect does not support MySQL 4.1 :( -- cascades of unfortunate events]

I simply found, that you'e mentioned v..12, thus I've posted here (under http://bugs.mysql.com/bug.php?id=5681 nobody seems to deal with similar questions).

Hoping waiting for fast-release;

Sledge
[28 Apr 2005 1:20] Paul DuBois
Noted in 3.51.12 changelog.