Bug #3350 User defined column types
Submitted: 31 Mar 2004 16:24 Modified: 2 Jan 2006 17:52
Reporter: [ name withheld ] Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version: OS:
Assigned to: CPU Architecture:Any

[31 Mar 2004 16:24] [ name withheld ]
Description:
For years now I have been using a series of functions that dynamically build a simple form based on an SQL query and a few declarations, when needed.  The controls I display depend on the column types of the data. For example, if the column is of type BOOLEAN, the functions would output a checkbox. It formats its output differently if the column is declared MONEY than if it is reported as DECIMAL

It would be good if MySql did report back the actual type specified in the CREATE statement, whatever the type used internatlly for storage might be.

This would also be very helpfull for strongly typed languages, where not everyting that evaluates to 0 is false or true otherwise.  You would be burdened with casting one variable type to another when you actually had the column types declared properly.

Actually, I'm reporting this as a feature request and not as a bug simply because it is documented.

How to repeat:
Not required, it is documented so.

Suggested fix:
Report back the actual column type specified in the CREATE statement

Now, if this is possible, I would like to sugest the following.

Adding a system table with metadata about the columns (and about the tables as well) would allow to add the proper column type, but also other user-defined column types.  Thus, I could define the types Euro and Pesetas as equivalent to MONEY (which should exist as a system synonym for DECIMAL with about 4 decimals).

Those user-defined column types would be stored in a separate system table which would already be populated with the existing column types such as BOOLEAN.  Queries for the column type should return this type, the other should be reported as Underlaying-Type, since, usually, it is irrelevant to the application.

In the meta-data table, additional data could be stored, such as:
- Descriptions for both tables and columns. 
- Sugested display name or caption, for automated reporting or form building tools.
- Prefered output formatting
- Accepted input mask (Regular Expression)
- Eventually, other, user-defined.
[2 Dec 2005 17:52] Valeriy Kravchuk
Thank you for a feature request. It sounds reasonable, but not so easy to implement (user-defined data types, I mean). 

As for the metadata, please, check the INFORMATION_SCHEMA of MySQL 5 (http://dev.mysql.com/doc/refman/5.0/en/information-schema.html) and inform what of your ideas about metadata are still left unimplemented.
[3 Jan 2006 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".