Trying to add a type modifier to user created type - Mailing list pgsql-general

From Carsten Kropf
Subject Trying to add a type modifier to user created type
Date
Msg-id 87B61935-5AF0-4839-8348-43C9CB63B385@fh-hof.de
Whole thread Raw
Responses Re: Trying to add a type modifier to user created type  (Yeb Havinga <yebhavinga@gmail.com>)
List pgsql-general
Hi *,
I have the following problem:
I wanted to add a new type that supports modifiers (comparable to numeric/varchar). I succeeded in adding the type
modifierfunctions to my new type. These methods are called and the modifier is set. However the modifiers are not
appliedhere. I don't know exactly how to get the modifiers to be applied to my type. I looked into the source code of
varchar/numericand a function called the same name as the type is added in there that gets called with a value of the
particulartype and the typmod, respectively. But I don't know, how to register this function properly in order to get
called,when sth is to be stored in the database. I also set up such a function and registered it in pg_proc (just
calledcreate function and made it public like this). My problem is that I don't know how to tell the database system
whento call my function. I don't see any possibility to do this here. Even reading the code of numeric/varchar didn't
help,because it just works in there. Where do I have to set up that this function is to be called when the modifier is
tobe applied? I thought, there would be something "magic" that just calls the function named as the given type in order
toapply the modifiers. My modifier function, however is never called. The type modifiers (typmodin and typmodout) are
calledproperly when requesting a description of the particular table or setting the modifier. However, unfortunately,
itis never applied to my column. How can I achieve this/What do I have to do to get it to work? 

Best regards
    Carsten Kropf

pgsql-general by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Howto analyse sql statement.
Next
From: venkatrao.b@tcs.com
Date:
Subject: One solution for Packages in Postgre