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

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

There's 957 functions in psql (output of \df).

Would I be so lucky that none of these functions is the one that you
suggested? :-(

Is "format_type(typeoid, typmod)" an internal C language function of the
Postgres backend? (please... please... say no :-)

If so (I'm afraid it will be) the only way to extract the actual length of a
varchar field or length of integer/fractional part of a numeric field would
be implementing the same functions the backend uses in my PHP modules. Any
other suggestion?

Regards,

--
Bernardo Pons



pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: Why would this use 600Meg of VM?
Next
From: "Bernardo Pons"
Date:
Subject: RE: Extracting metadata about attributes from catalog