How to get the size of non fixed-length field from system catalog ?

From: Postgres User <postgres(dot)developer(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: How to get the size of non fixed-length field from system catalog ?
Date: 2009-06-08 21:03:17
Message-ID: b88c3460906081403q7634aca4x8e5998a679e1e422@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm writing a small ORM tool and have written a number of queries to
retrieve table metadata. One piece of data that I'm having trouble
hunting down is the size of a CHAR field. For example, one table has
a 'user_id' column of type CHAR(36). But when I look at the
pg_attribute and pg_type tables, I can't seem to find this size value
of 36.

Can anyone share the SQL that returns the size of a CHAR? It is NOT
the 'typlen' column. The answer may be the 'typelem' column, but I
can't find details on how to decode it.

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2009-06-08 21:23:01 Re: How to get the size of non fixed-length field from system catalog ?
Previous Message Merlin Moncure 2009-06-08 20:30:05 Re: NOT NULL with CREATE TYPE