Bug #61032 Convert to Integers Returns Errorneous Results

Submitted: 2 May 2011 22:46 Modified: 3 Jun 2011 1:36
Reporter: Benjamin Robinson Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.0.51b OS:Windows (Vista)
Assigned to: CPU Architecture:Any
Tags: convert, SQL

[2 May 2011 22:46] Benjamin Robinson
Description:
Convert function works with 'signed' and 'unsigned' but not the 'int' nor 'integer' datatypes.  Attempting to convert to int/integer results in a 1064 error.

How to repeat:
select convert(-1.5, signed);    -- Returns (-2)
select convert(-1.5, unsigned);  -- Returns (0)
select convert(1.5, int);        -- Throws Error 1064

Suggested fix:
Convert function should convert integers the same as unsigned [integers].
[3 May 2011 1:36] MySQL Verification Team
Thank you for the bug report.  Could you please check the Manual:

http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html

CONVERT(expr,type)

The type can be one of the following values: 

SIGNED [INTEGER]
UNSIGNED [INTEGER]

Then your example convert(1.5, int) is actually wrong syntax.

Thanks in advance.
[3 Jun 2011 23: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".

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.