Subject Re: [firebird-support] Result type of RPAD() and LPAD()
Author Paul Vinkenoog
Hello Chris,

> In the documentation for LPAD and RPAD is written that the result type is VARCHAR(32765) and there is a tip to cast the result to a useful length.
>
> When using LPAD or RPAD in a "SELECT LPAD( LABEL, 8, '-' ) FROM...", FlameRobin and IBExpert both return a VARCHAR(8), corresponding to the length argument of xPAD(), without casting.
>
> My question: is the cast still recommended or obsolete?

In Firebird 2.5, the result is VARCHAR(n) with n equal to the second argument.

I didn't know that it was backported to 2.1.4 as well.

You can forget the casts, then.

> I use the internal functions. Is the behavior different if I use the external functions from ib_udf.dll?

Yes. You declare them with the desired output length. But don't bother with them. Stick to the internal functions, since they behave so well now.


Cheers,
Paul Vinkenoog