Re: Describe table and varchar lrngth

From: Tony Li <tony(dot)li(at)tony(dot)li>
To: Constantin Khatsckevich <home(at)const(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Describe table and varchar lrngth
Date: 2004-07-15 17:05:42
Message-ID: 347A356A-D681-11D8-BDEB-000A95D1475E@tony.li
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Here's what I came up with:

select format_type(a.atttypid, a.atttypmod) from pg_attribute a,
pg_class c where a.attrelid = c.oid and a.attname = '<field>' and
c.relname = '<relation>'

The result needs to be parsed...

Tony

On Jul 15, 2004, at 1:38 AM, Constantin Khatsckevich wrote:

> Hello!
>
> I need get ordered length of the varchcar field in PHP. But
> pg_FieldLength return -1 (it's right), but I need to get max length
> for this field. For example,
> create table t (
> str varchar(40)
> );
>
> I need to get 40...
>
>
> Help me please!
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Walter Landry 2004-07-15 18:08:33 Parallel Postgresql
Previous Message Chuck Bearden 2004-07-15 16:15:28 Horology & stats tests fail in 7.4.3/RH 9