Received: from thelab.hub.org (tc-12.acadiau.ca [131.162.2.112]) by hub.org (8.8.8/8.7.5) with ESMTP id XAA17556 for ; Thu, 14 May 1998 23:28:07 -0400 (EDT) Received: from localhost (scrappy@localhost) by thelab.hub.org (8.8.8/8.8.2) with SMTP id AAA07397; Fri, 15 May 1998 00:28:02 -0300 (ADT) X-Authentication-Warning: thelab.hub.org: scrappy owned process doing -bs Date: Fri, 15 May 1998 00:28:02 -0300 (ADT) From: The Hermit Hacker To: pgsql-sql@postgresql.org cc: Reshma Choodanath Subject: Listing the table fields .... Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII =================================================================== This message has been sent to a DEAD mailing list, and subsequently reforwarded to the proper one: pgsql-sql@postgresql.org =================================================================== Hi, This piece of code list the the table fields with the attribute name and the fieldtype. How do I get the Field size for that attribute. f code list the the table fields with the attribute name and the fieldtype. How do I get the Field size for that attribute? Eg, Say one of the attributes is :- name varchar (50) I want to trap the value 50. I tried the typlen and typprtlen, but that was not what I was looking for. # list table fields (attribute) in given table def ListAllFields(pgcnx, table): list = [] for node in pgcnx.query("""SELECT c.relname, a.attname, t.typname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '%s' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid """ % table).getresult(): list.append(node[1], node[2], node[3]) return list Thanks, Reshma.