Skip site navigation (1) Skip section navigation (2)

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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Klein, Robert" <rvklein(at)ober(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, bugs(at)postgresql(dot)org
Subject: Re: Need some help: attlen is pg_attributes gives a negative value.. .
Date: 2000-05-03 20:56:06
Message-ID: 17642.957387366@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Klein, Robert" <rvklein(at)ober(dot)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

In response to

Responses

pgsql-bugs by date

Next:From: Roland RobertsDate: 2000-05-04 03:26:56
Subject: Re: Need some help: attlen is pg_attributes gives a negative value.. .
Previous:From: Klein, RobertDate: 2000-05-03 20:40:27
Subject: RE: Need some help: attlen is pg_attributes gives a negative value.. .

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group