Create Type with typmod_in - Mailing list pgsql-sql

From Russell Keane
Subject Create Type with typmod_in
Date
Msg-id 8D0E5D045E36124A8F1DDDB463D548557CC7AB3991@mxsvr1.is.inps.co.uk
Whole thread
Responses Re: Create Type with typmod_in
List pgsql-sql

I’m trying to create a custom type (PostgreSQL 9.0) which will essentially auto truncate a string to a certain length.

 

The type (auto_trunc_char) will be used as follows:

 

Create table blah (

                Some_name auto_trunc_char(40)

)

 

Can this be done purely in plpgsql?

If so, how?

 

I know I have to declare the following (at least) but I’m not sure how to flesh out the functions:

 

create type auto_trunc_char (

                INTERNALLENGTH = VARIABLE,

                INPUT = auto_trunc_char_in_function,

                OUTPUT = auto_trunc_char_out_function,

                TYPMOD_IN = auto_trunc_char_modifier_in

);

 

 

Regards,

 

Russell Keane

INPS

 

Subscribe to the Vision e-newsletter

Subscribe to the Helpline Support Bulletin

  Subscribe to the Helpline Blog RSS Feed

 



Registered name: In Practice Systems Ltd.
Registered address: The Bread Factory, 1a Broughton Street, London, SW8 3QJ
Registered Number: 1788577
Registered in England
Visit our Internet Web site at www.inps.co.uk
The information in this internet email is confidential and is intended solely for the addressee. Access, copying or re-use of information in it by anyone else is not authorised. Any views or opinions presented are solely those of the author and do not necessarily represent those of INPS or any of its affiliates. If you are not the intended recipient please contact is.helpdesk@inps.co.uk

pgsql-sql by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: intervals
Next
From: David Johnston
Date:
Subject: Re: Create Type with typmod_in