Re: typemode for variable types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: typemode for variable types
Дата
Msg-id 9068.1393274053@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: typemode for variable types  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: typemode for variable types  (Greg Stark <stark@mit.edu>)
Список pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Bruce Momjian escribi�:
>> Well, typmods are type-specific, so there is no official way to
>> calculate it.  I would look at how an existing type uses typmod and copy
>> that.

> Our system is pretty neat.  See a complex example here:
> https://github.com/postgis/postgis/blob/svn-trunk/postgis/gserialized_typmod.c

One other point is that if you do consult the varchar functions as
an example, be aware that there's an offset of 4 in their definition
of the typmod (eg, for varchar(3) the stored typmod is 7).  This is
entirely for legacy reasons so there's no good reason to duplicate it
in a new custom-made type.  Except for the rule that negative values
mean "unspecified typmod" (which you have to support), you can
define the contents of the typmod value however you want.
        regards, tom lane



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

Предыдущее
От: Jeff Janes
Дата:
Сообщение: Re: often PREPARE can generate high load (and sometimes minutes long unavailability)
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Another possible corruption bug in 9.3.2 or possibly a known MultiXact problem?