Re: Need some help: attlen is pg_attributes gives a negative value.. .

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Need some help: attlen is pg_attributes gives a negative value.. .
Дата
Msg-id 17642.957387366@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Need some help: attlen is pg_attributes gives a negative value.. .  ("Klein, Robert" <rvklein@ober.com>)
Список pgsql-bugs
"Klein, Robert" <rvklein@ober.com> writes:
> [ attlen for a char(n) field is -1 ]

> I know in previous versions the length as defined in the create table
> statement was given.  Any ideas?

Must have been quite a few versions back; attlen has been -1 for
variable-length datatypes for as long as I've been paying attention.
(Of course char(n) isn't *really* variable length, but it's treated
that way so that the representation is the same as for varchar(n) and
text.)

atttypmod is what you want for determining the length of char(n) fields.
I believe it's n+4 for a char(n) field.

            regards, tom lane

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

Предыдущее
От: "Klein, Robert"
Дата:
Сообщение: RE: Need some help: attlen is pg_attributes gives a negat ive value.. .
Следующее
От: Roland Roberts
Дата:
Сообщение: Re: Need some help: attlen is pg_attributes gives a negative value.. .