Bug #101720 Make the last argument of the LPAD/RPAD(s, length, c) functions optional
Submitted: 23 Nov 2020 13:52 Modified: 23 Nov 2020 14:06
Reporter: Dariusz Dacko Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S4 (Feature request)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[23 Nov 2020 13:52] Dariusz Dacko
Description:
I propose to make the last argument of the LPAD/RPAD(s, length, c) functions optional (the space ' ' by default).

Reason:

The last argument c is optional in PostgreSQL and Oracle.

Scalar SQL functions differ quite significantly among RDBMS. This step will reduce this difference. Other changes in RDBMS proposed by me are here: https://github.com/iwis/Scalar-SQL-functions/blob/main/Proposed_changes.md

How to repeat:
The function:
  LPAD('abc', 5, ' ');
returns '  abc'.

But this function:
  LPAD('abc', 5);
raises "Incorrect parameter count in the call to native function 'LPAD'".

https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=0577871c371b74d9bfed06641ac38969

Suggested fix:
Make the last argument of the LPAD/RPAD(s, length, c) functions optional (the space ' ' by default).
[23 Nov 2020 14:06] MySQL Verification Team
Hello Dariusz,

Thank you for the feature request.

regards,
Umesh