"Mark McArthey" <mcarthey(at)execpc(dot)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
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
In response to
pgsql-novice by date
|Next:||From: Daniel Bautista||Date: 2001-10-24 13:29:24|
|Subject: current and beta versions|
|Previous:||From: Jochem van Dieten||Date: 2001-10-23 23:08:57|
|Subject: Re: Performance question (PostgreSQL 7.1.3)|