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 Raw |
Responses |
Re: Create Type with typmod_in
|
List | pgsql-sql |
<div class="WordSection1"><p class="MsoNormal">I’m trying to create a custom type (PostgreSQL 9.0) which will essentiallyauto truncate a string to a certain length.<p class="MsoNormal"> <p class="MsoNormal">The type (auto_trunc_char)will be used as follows:<p class="MsoNormal"> <p class="MsoNormal">Create table blah (<p class="MsoNormal"> Some_name auto_trunc_char(40)<p class="MsoNormal">)<p class="MsoNormal"> <p class="MsoNormal">Canthis be done purely in plpgsql?<p class="MsoNormal">If so, how?<p class="MsoNormal"> <p class="MsoNormal">Iknow I have to declare the following (at least) but I’m not sure how to flesh out the functions:<p class="MsoNormal"> <pclass="MsoNormal">create type auto_trunc_char (<p class="MsoNormal"> INTERNALLENGTH =VARIABLE,<p class="MsoNormal"> INPUT = auto_trunc_char_in_function,<p class="MsoNormal"> OUTPUT= auto_trunc_char_out_function,<p class="MsoNormal"> TYPMOD_IN = auto_trunc_char_modifier_in<p class="MsoNormal">);<pclass="MsoNormal"> <p class="MsoNormal"> <p class="MsoNormal"><span style="font-size:10.0pt">Regards,</span><pclass="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif";color:#365F91"> </span><pclass="MsoNormalCxSpMiddle" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><spanstyle="font-size:10.0pt;font-family:"Times New Roman","serif";color:black">RussellKeane</span></b><b><span style="font-size:10.0pt;color:black"></span></b><p class="MsoNormalCxSpMiddle"style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt;color:black">INPS</span></b><pclass="MsoNormalCxSpMiddle" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><spanstyle="font-size:10.0pt;color:black"> </span></b><p class="MsoNormal"><spanstyle="font-size:9.0pt"><a href="http://www.inps4.co.uk/news/enewsletter/"><span style="color:blue">Subscribeto the Vision e-newsletter</span></a></span><p class="MsoNormal"><span style="font-size:9.0pt"><ahref="http://www.inps4.co.uk/my_vision/helpline/support-bulletins"><span style="color:blue">Subscribeto the Helpline Support Bulletin</span></a></span><p class="MsoNormal"><span style="font-size:9.0pt;color:black"><imgborder="0" height="14" id="Picture_x0020_1" src="cid:image001.png@01CC9AFA.4BF01AF0"width="14" /> </span><span style="font-size:9.0pt;color:#E36C0A"><a href="http://www.inps4.co.uk/rss/helplineblog.rss"><spanstyle="color:#E36C0A">Subscribe to the Helpline Blog RSS Feed</span></a></span><p class="MsoNormal"> </div><br /><hr /><font color="Black" face="Arial" size="2">Registered name:In Practice Systems Ltd.<br /> Registered address: The Bread Factory, 1a Broughton Street, London, SW8 3QJ<br /> RegisteredNumber: 1788577<br /> Registered in England<br /> Visit our Internet Web site at www.inps.co.uk<br /> The informationin this internet email is confidential and is intended solely for the addressee. Access, copying or re-use ofinformation in it by anyone else is not authorised. Any views or opinions presented are solely those of the author anddo not necessarily represent those of INPS or any of its affiliates. If you are not the intended recipient please contactis.helpdesk@inps.co.uk<br /><br /></font>