Re: how to determine which types take a length argument

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: how to determine which types take a length argument
Дата
Msg-id 20060809145357.GN22329@svana.org
обсуждение исходный текст
Ответ на how to determine which types take a length argument  (Robert Treat <xzilla@users.sourceforge.net>)
Ответы Re: how to determine which types take a length argument
Список pgsql-hackers
On Wed, Aug 09, 2006 at 10:44:22AM -0400, Robert Treat wrote:
> Is there a way to determine which datatypes take a length argument (eg.
> varchar, time, etc...) by looking in the system catalogs? pg_type doesnt seem
> to have the info... or is there a single place in the back end code that
> contains this info?

Sure, wherever the typlen column in pg_type is -1. In that column,
positive is fixed length, -1 is a verlena type and -2 is null
terminated (for cstring).

In the backend this info is available using get_typlenbyval() or a few
other functions, see utils/cache/lsyscache.c

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 8.2 features status
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: proposal for PL packages for 8.3.