Re: Extracting metadata about attributes from catalog

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Bernardo Pons" <bernardo(at)atlas-iap(dot)es>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Extracting metadata about attributes from catalog
Date: 2001-06-22 21:58:39
Message-ID: 6050.993247119@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Bernardo Pons" <bernardo(at)atlas-iap(dot)es> writes:
> The problem I've found is that the attribute that stores the info about data
> length (attribute atttypmod of catalog table pg_attribute) is some kind of
> internal coding. For example, for an attribute varchar(100) atttypmod value
> is 104; for an attribute numeric(6,0) atttypmod value is 393220.

Yup.

> I guess I would need some kind of function in order to get the actual lenght
> for the attributes. Does this function exist? Where can I find it?

In 7.1, "format_type(typeoid, typmod)" is what produces the type
displays seen in psql. This may or may not be exactly what you want,
but that's how the knowledge of typmod encoding is exported at the
moment.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-06-22 22:02:45 Re: Multiple Indexing, performance impact
Previous Message Bruce Momjian 2001-06-22 21:56:17 Re: Multiple Indexing, performance impact