Re: system catalog and varchar datatype - Mailing list pgsql-general

From Tony Li
Subject Re: system catalog and varchar datatype
Date
Msg-id C1C3FDFC-D9D4-11D8-B8C1-000A95D1475E@tony.li
Whole thread Raw
In response to Re: system catalog and varchar datatype  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general

For my purposes, I was happier to get the output of format_type() and
parse it.  This meant that I didn't have to carry around some magic
constant that wasn't part of the documented interface...

Tony


On Jul 19, 2004, at 2:31 PM, Stephan Szabo wrote:

> On Mon, 19 Jul 2004, sandra ruiz wrote:
>
>> hi, I need to find out the length of a varchar attribute ..
>>
>> for example,if a I have an atribute "description varchar(256)"  I
>> would
>> expect to see this "256" in the pg_attribute table.
>>
>> there's is an "attlen" In the pg_attribute but this doesn't give any
>> information
>
> Atttypmod gives this information, but the value is datatype specific.
>
> For varchar (and char) at least, the atttypmod is 4 greater than the
> maximum length, so atttypmod for the above would be 260.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: system catalog and varchar datatype
Next
From: Jean-Christian Imbeault
Date:
Subject: Postgres vs Sybase ASE