Re: Custom type's modifiers
От | Tom Lane |
---|---|
Тема | Re: Custom type's modifiers |
Дата | |
Msg-id | 1749733.1719505456@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Custom type's modifiers (Marthin Laubscher <postgres@lobeshare.co.za>) |
Список | 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 по дате отправления: