Bug #33906 | online help for CAST is out of date | ||
---|---|---|---|
Submitted: | 17 Jan 2008 19:12 | Modified: | 17 Jan 2008 19:28 |
Reporter: | Baron Schwartz (Basic Quality Contributor) | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | MySQL Server: Documentation | Severity: | S3 (Non-critical) |
Version: | 5.0.40 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | qc |
[17 Jan 2008 19:12]
Baron Schwartz
[17 Jan 2008 19:16]
Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with a newer version, 5.0.45 at least, and inform about the results. Look: mysql> select version(); +------------------------------+ | version() | +------------------------------+ | 5.0.54-enterprise-gpl-nt-log | +------------------------------+ 1 row in set (0.00 sec) mysql> help cast Name: 'CAST' Description: Syntax: CAST(expr AS type), CONVERT(expr,type), CONVERT(expr USING transcoding_name) The CAST() and CONVERT() functions take a value of one type and produce a value of another type. The type can be one of the following values: o BINARY[(N)] o CHAR[(N)] o DATE o DATETIME o DECIMAL o SIGNED [INTEGER] o TIME o UNSIGNED [INTEGER] BINARY produces a string with the BINARY data type. See http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html for a description of how this affects comparisons. If the optional length N is given, BINARY(N) causes the cast to use no more than N bytes of the argument. As of MySQL 5.0.17, values shorter than N bytes are padded with 0x00 bytes to a length of N. CHAR(N) causes the cast to use no more than N characters of the argument. The DECIMAL type is available as of MySQL 5.0.8. CAST() and CONVERT(... USING ...) are standard SQL syntax. The non-USING form of CONVERT() is ODBC syntax. CONVERT() with USING is used to convert data between different character sets. In MySQL, transcoding names are the same as the corresponding character set names. For example, this statement converts the string 'abc' in the default character set to the corresponding string in the utf8 character set: SELECT CONVERT('abc' USING utf8); Examples: SELECT enum_col FROM tbl_name ORDER BY CAST(enum_col AS CHAR); I clearly see DECIMAL above...
[17 Jan 2008 19:19]
Baron Schwartz
not-a-bug: I get the correct result in 5.0.45 too. Sorry I didn't check first :-\
[17 Jan 2008 19:28]
Valeriy Kravchuk
Not repeatable since 5.0.45 at least.