Bug #2484 SELECT SUBSTRING bug

Submitted: 22 Jan 2004 14:21 Modified: 22 Jan 2004 14:43
Reporter: Donny Simonton Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 and 3.x OS:Linux (Linux)
Assigned to: Dean Ellis CPU Architecture:Any

[22 Jan 2004 14:21] Donny Simonton
Description:
When you run SELECT SUBSTRING( 012345, 1, 3 ) it returns 123, but when you run SELECT SUBSTRING( 012345, 0, 3 ) it returns blank.  We have tried this on a 4.1.0 box, 4.1.1 box and 3.23.51 box.  

Of course we could use left command, but this should still work with 0,3.  We also tried it with the from/for command inside of the substring and that returns the same results.

How to repeat:
Run the select.
[22 Jan 2004 14:43] Dean Ellis
This is expected behaviour.

1) The position for SUBSTRING() begins with 1, not 0.
2) Converting the integer 012345 to a string results in a string of '12345'.

Thank you.
[22 Jan 2004 14:47] Donny Simonton
We just figured that one out, sorry for wasting your time on this one.

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

Page generated in 0.052 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.