Re: Extracting metadata about attributes from catalog - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Extracting metadata about attributes from catalog
Date
Msg-id 6050.993247119@sss.pgh.pa.us
Whole thread Raw
In response to Extracting metadata about attributes from catalog  ("Bernardo Pons" <bernardo@atlas-iap.es>)
Responses RE: Extracting metadata about attributes from catalog
List pgsql-hackers
"Bernardo Pons" <bernardo@atlas-iap.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] Multiple Indexing, performance impact
Next
From: Bruce Momjian
Date:
Subject: Re: plperl doc