Bug #1944 Function RPad() sometimes produce unexpected result

Submitted: 25 Nov 2003 5:58 Modified: 4 Dec 2003 2:47
Reporter: Yuriy Pavlyutkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.17 and 4.1.1 OS:Windows (Windows 2000 Prof SP2)
Assigned to: Sergei Glukhov CPU Architecture:Any

[25 Nov 2003 5:58] Yuriy Pavlyutkin
Description:
For function RPad(str1,n,str2) is produced incorrect result when str1 or str2 is string-type function of numeric argument. For example, when Str2 is some string-type function of numeric argument, result will be 
Str1 + FillingOf(Left(Str1,Lenght(Str2)), instead Str1 + FillingOf(Str2).

Symmetric function LPad() for such arguments works right.

How to repeat:
Select RPad("My personal string",60,Left(MD5("1"),10));
Select RPad("My personal string",50,1234); /* 1234 without brackets */
[25 Nov 2003 14:03] Dean Ellis
Verified with 4.0.17 and 4.1.1; also occurs on Linux.

Thank you.

Also occurs using CONCAT:

SELECT RPAD('STRING', 20, CONCAT('p','a','d') );
SELECT LPAD('STRING', 20, CONCAT('p','a','d') );

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

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