Re: column length?
От | Tom Lane |
---|---|
Тема | Re: column length? |
Дата | |
Msg-id | 16504.1003894388@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | column length? ("Mark McArthey" <mcarthey@execpc.com>) |
Список | pgsql-novice |
"Mark McArthey" <mcarthey@execpc.com> writes: > I am wondering how the column length is determined. The attached output is > for my test table. Running '\d player' shows me that the columns are > varchar(20), but the attlen is listed as -1. Where does the value '20' come > from? attlen = -1 is a generic value indicating "variable length type". All columns of varchar type will have attlen = -1 (as will all columns of any other variable-length datatype). The gold is hidden in the atttypmod column, which has a datatype-specific interpretation. For varchar columns, atttypmod is interpreted as "max chars plus 4". (The plus-4 is a historical wart.) See src/backend/utils/adt/format_type.c for info about the interpretation of typmod for other datatypes. regards, tom lane
В списке pgsql-novice по дате отправления: