Re: Create Type with typmod_in - Mailing list pgsql-sql

From David Johnston
Subject Re: Create Type with typmod_in
Date
Msg-id F8B81014-4F36-4192-8A73-E2A5B335F013@yahoo.com
Whole thread Raw
In response to Create Type with typmod_in  (Russell Keane <Russell.Keane@inps.co.uk>)
List pgsql-sql
On Nov 4, 2011, at 10:01, Russell Keane <Russell.Keane@inps.co.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.


pgsql-sql by date:

Previous
From: Russell Keane
Date:
Subject: Create Type with typmod_in
Next
From: John Fabiani
Date:
Subject: the use of $$string$$