Re: Type modifier parameter of input function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Type modifier parameter of input function
Дата
Msg-id 5754.1342201828@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Type modifier parameter of input function  (Michael Schneider <mschneid@mpi-bremen.de>)
Список pgsql-hackers
Michael Schneider <mschneid@mpi-bremen.de> writes:
> whenever pg calls my input function, the type modifier parameter is 
> ALWAYS (-1).
> ...
> How can I convince pg to call the input function with the correct type 
> modifier?

You can't.  Per the comment in coerce_type:
        * For most types we pass typmod -1 to the input routine, because        * existing input routines follow
implicit-coercionsemantics for        * length checks, which is not always what we want here.  Any length        *
constraintwill be applied later by our caller.    An exception        * however is the INTERVAL type, for which we
*must*pass the typmod        * or it won't be able to obey the bizarre SQL-spec input rules. (Ugly        * as sin, but
sois this part of the spec...)
 

If the SQL standard didn't have such bizarrely inconsistent rules for
the results of implicit vs explicit coercions to char(n) and varchar(n),
we'd have more flexibility here.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Schneider
Дата:
Сообщение: Type modifier parameter of input function
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: pl/perl and utf-8 in sql_ascii databases