Neil Conway <neilc@samurai.com> writes:
> I think there's a case to be made that we shouldn't accept either
> leading or trailing whitespace, but it seems too late to go down that
> path: it isn't worth breaking backward compatibility over, for one thing.
To do that we'd have to use separate code for I/O and casting. As
an example, this current behavior is unquestionably contrary to the
spec text I cited:
regression=# select ' 42'::text::int;
int4
------
42
(1 row)
regression=# select ' 42 '::text::int;
ERROR: invalid input syntax for integer: " 42 "
regression=#
regards, tom lane