Marthin Laubscher <postg...@lobeshare.co.za> writes: > I don't see another function getting passed the value so I'd assume that > (unless I return a MyType value from one of my own functions which would > follow its internal logic to determine which type modifiers to use) the only > way a MyType can get an initial value is via the input function. If the type > is in a table column the input function would be called with the default > value specified in external format if a value isn't specified during insert, > but either way it would always originate from the eternal format. I suppose > when a cast is involved it goes via the external format as well, right?
The only code anywhere in the system that can produce a MyType value is code you've written. So that has to come originally from your input function, or cast functions or constructor functions you write. You'd be well advised to read the CREATE CAST doco about how to support notations like 'something'::MyType(x,y,z). Although the input function is expected to be able to apply a typemod if it's passed one, in most situations coercion to a specific typemod is handled by invoking a multi-parameter cast function. regards, tom lane