X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 7D1FE9FB1C1 for ; Fri, 5 May 2006 12:01:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 54272-04 for ; Fri, 5 May 2006 12:01:46 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wx-out-0102.google.com (wx-out-0102.google.com [66.249.82.207]) by postgresql.org (Postfix) with ESMTP id 50F449FA372 for ; Fri, 5 May 2006 12:01:45 -0300 (ADT) Received: by wx-out-0102.google.com with SMTP id s13so560821wxc for ; Fri, 05 May 2006 08:01:45 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=PQp8gPj1aaE2kSVUw2I8xBU2Z7gZ+TOEcQGe76nitOKIrYCQypbAisYsAg2M4rqxccQxfFqvH/4EXykOUvQS38SkSEd62kLIANLqiFcImDvCh/MBS+yGFfYi4tVNRu2GgUYUte/nBHu+mPFJrTx3Ez6RpTfw426IwDcVBmYD4I0= Received: by 10.70.13.10 with SMTP id 10mr1154918wxm; Fri, 05 May 2006 08:01:45 -0700 (PDT) Received: by 10.70.80.16 with HTTP; Fri, 5 May 2006 08:01:45 -0700 (PDT) Message-ID: <1d219a6f0605050801n43054504j112a62f10c8fcc59@mail.gmail.com> Date: Fri, 5 May 2006 11:01:45 -0400 From: "Chris Hoover" To: "pgsql-admin@postgresql.org" Subject: Where to get column length MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_44437_22422481.1146841305332" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/55 X-Sequence-Number: 21587 ------=_Part_44437_22422481.1146841305332 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I know it is in the docs, but right now I can't see it. How do I pull the length of a specific varchar column? I have just found a problem with our schema being out of sync on one specific column, and need to find out how many of our 200+ databases need to be fixed. Here is what I have so far: select * from pg_class, pg_attribute where pg_class.relkind =3D 'r' and pg_attribute.attrelid =3D pg_class.oid and pg_class.relname =3D 'mytable' and pg_attribute.attname =3D 'problem_column' and ???? !=3D 256; -- need to report anytime this column is not a varchar(256)= . Thanks, Chris ------=_Part_44437_22422481.1146841305332 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I know it is in the docs, but right now I can't see it.

How do I pu= ll the length of a specific varchar column?  I have just found a probl= em with our schema being out of sync on one specific column, and need to fi= nd out how many of our 200+ databases need to be fixed.

Here is what I have so far:
select *
from pg_class, pg_attrib= ute
where pg_class.relkind =3D 'r' and
pg_attribute.attrelid =3D pg_c= lass.oid and
pg_class.relname =3D 'mytable' and
pg_attribute.attname = =3D 'problem_column' and
???? !=3D 256;  -- need to report anytime this column is not a var= char(256).

Thanks,

Chris
------=_Part_44437_22422481.1146841305332--