SHOW COLUMN TYPES: A hidden MySQL treat?Tue, Sep 19, 2006 in Databases
I was poking around in the MySQL source code, namely in sql/sql_yacc.yy, and found a hidden treat: there’s a
SHOW COLUMN TYPES command. It’s fun to read source code!
The command is undocumented, but does work. It returns just two rows, which give information about
TINYINT UNSIGNED. And it has been in the source for a long time, certainly since version 4.1.21. There’s even a status counter for it in the
SHOW STATUS command:
It’s clearly unfinished (here’s a bug report about it), and I think I can guess why: it’s just duplicate information that, like code comments, can get out of date and be a pain to maintain. If it were me, I’d yank it out of the source, and fix up the online help instead, which on version 5.0.24a-log says pretty much nothing helpful:
mysql> help column types; Name: 'Column Types' Description: AUTO_INCREMENTExamples: N
Another possibility would be to put it in the
INFORMATION_SCHEMA instead, but I don’t think the SQL standard mentions such information being there. I could be wrong about this, but I don’t see it. Can anyone confirm this? It strikes me as an odd omission, since there are other views that seem less essential, such as
About The Author
Baron is the founder and CEO of VividCortex. He is the author of High Performance MySQL and many open-source tools for performance analysis, monitoring, and system administration. Baron contributes to various database communities such as Oracle, PostgreSQL, Redis and MongoDB.