On Nov 4, 2011, at 10:01, Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)uk> wrote:
> I’m trying to create a custom type (PostgreSQL 9.0) which will essentially auto truncate a string to a certain length.
>
>
>
>
>
> Can this be done purely in plpgsql?
>
> If so, how?
>
>
>
An explicit cast of a value to varchar(n) causes the value to be truncated to n characters.
E.g., '1234567'::varchar(5) -> '12345'
How to integrate that knowledge into a type I do not know.
David J.
>