The SQL:1999 standard on the OVERLAY function specifies:
OVERLAY (<character value expression>
PLACING <character value expression>
FROM <start position>
[ FOR <string length> ] )
a) Let CV be the first <character value expression>, let SP be the <start position>, and let RS
be the second <character value expression>.
b) If <string length> is specified, then let SL be <string length>; otherwise, let SL be CHAR_
LENGTH(RS).
c) The <character overlay function> is equivalent to:
SUBSTRING ( CV FROM 1 FOR SP - 1 )
|| RS
|| SUBSTRING ( CV FROM SP + SL )
Our implementation was not compliant because, when <string length> was not specified, it inserted the second expression into the first one at the specified position without overwriting the content, which is incorrect.
The LPAD and RPAD functions did not generate overflow error if the length passed in is larger than the maximum field length, now they do.
Behavior Change: This modification is a change in behavior.