Bug #14792 SHOW FIELDS or COLUMNS truncate TYPE value
Submitted: 9 Nov 2005 16:45 Modified: 10 Nov 2005 11:26
Reporter: Maurizio Coda Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.11-Debian_4sarge2-log OS:Linux (Linux/Windows 2003 Server)
Assigned to: CPU Architecture:Any

[9 Nov 2005 16:45] Maurizio Coda
Description:
MySQL is installed on Debian.
I'm sending this query SHOW FIELDS FROM myTable by an asp page on W2003 Server using mysql-connector-odbc-3.51.12-win32.
The column TYPE is truncated?

this:
set('CONTRATTO OPZIONE','VAUCHER','DIRECTIONS','WELCOME_AREACLIENTE','CONTRATTO_CLIENTE','BANK INFO','WELCOME_AREAPROPRIETARIO','CONTRATTO_PROPRIETARIO','QUESTIONARIO_CASA','QUESTIONARIO_CASA_FINE','QUESTIONARIO_CASA_GRAZIE','QUESTIONARIO_CASA_EMAIL')

is returned in this
set('CONTRATTO OPZIONE','VAUCHER','DIREC

Ciao 
Maurizio Coda

How to repeat:
.
[9 Nov 2005 18:38] Valeriy Kravchuk
Thank you for a problem report. It may be a Connector/ODBC problem, though. I was not able to repeat it on 4.1.16-BK using mysql command line tool:

[openxs@Fedora 4.1]$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.16

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> create table t_set(c1 set('CONTRATTO
    '> OPZIONE','VAUCHER','DIRECTIONS','WELCOME_AREACLIENTE','CONTRATTO_CLIENTE'
,'BANK
    '> INFO','WELCOME_AREAPROPRIETARIO','CONTRATTO_PROPRIETARIO','QUESTIONARIO_C
ASA','Q
    '> UESTIONARIO_CASA_FINE','QUESTIONARIO_CASA_GRAZIE','QUESTIONARIO_CASA_EMAIL'));
Query OK, 0 rows affected (0,03 sec)

mysql> desc t_set;
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------+------+-----+---------+-------+
| Field | Type

                          | Null | Key | Default | Extra |
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------+------+-----+---------+-------+
| c1    | set('CONTRATTO\nOPZIONE','VAUCHER','DIRECTIONS','WELCOME_AREACLIENTE',
'CONTRATTO_CLIENTE','BANK\nINFO','WELCOME_AREAPROPRIETARIO','CONTRATTO_PROPRIETA
RIO','QUESTIONARIO_CASA','Q\nUESTIONARIO_CASA_FINE','QUESTIONARIO_CASA_GRAZIE','
QUESTIONARIO_CASA_EMAIL') | YES  |     | NULL    |       |
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------+------+-----+---------+-------+
1 row in set (0,01 sec)

(SHOW FIELDS FROM t_set gives the same result, as documented)

Please, check with command line client (mysql) and using your ASP but with a newer version of MySQL (4.1.15). 

Your exact test case will be useful too. May be, you just select the result in some variable of limited length, and it is truncated...
[10 Nov 2005 11:26] Maurizio Coda
Using ODBC Connector 3.51.11 or 3.51.12 the query "SHOW FIELDS FROM mytable" OR "DESCRIBE mytable" displays always wrong the ENUM and SET fields type.
Another mystery is in this VBScript exemple: 

set con = server.createobject("ADODB.Connection")
set rec = server.createobject("ADODB.Recordset")
con.open "myDB","",""
rec.open "SHOW FIELDS FROM mytable", con, 1, 3
## the table contain on a field SET('bla bla','bla bla','bla bla','bla bla','bla bla','bla bla','bla bla','bla bla','bla bla') ###
response.write rec.fields("Type")---> display up to 40 caracthers
response.write len(rec.("Type"))---> display the correct lenght, that was 251 !!!

I solved the problem downgrading my ODBC connector from the 3.51.12 version to 3.51.09
Now i can see all!!

Maurizio Coda