Re: Custom type's modifiers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Custom type's modifiers
Date
Msg-id 1749733.1719505456@sss.pgh.pa.us
Whole thread Raw
In response to Re: Custom type's modifiers  (Marthin Laubscher <postgres@lobeshare.co.za>)
List pgsql-hackers
Marthin Laubscher <postgres@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
myown functions which would follow its internal logic to determine which type modifiers to use) the only way a MyType
canget an initial value is via the input function. If the type is in a table column the input function would be called
withthe default value specified in external format if a value isn't specified during insert, but either way it would
alwaysoriginate 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: JIT causes core dump during error recovery
Next
From: Ranier Vilela
Date:
Subject: Re: JIT causes core dump during error recovery