That may be the better way to say it. But, what I wanted to point out was that the behavior had changed. Previously ::varchar(4) had worked. However, now since 7.2 only ::text or varchar(n) where is sufficiently large to hold the digits.Thomas Swan writes:select (random( )*10)::varchar(4)
worked in 7.1.3
fails in 7.2
ERROR: value too long for type character varying(4)
Say what you really mean:
select substring(random()*10 for 4);