Where to get column length

From: "Chris Hoover" <revoohc(at)gmail(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Where to get column length
Date: 2006-05-05 15:01:45
Message-ID: 1d219a6f0605050801n43054504j112a62f10c8fcc59@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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 = 'r' and
pg_attribute.attrelid = pg_class.oid and
pg_class.relname = 'mytable' and
pg_attribute.attname = 'problem_column' and
???? != 256; -- need to report anytime this column is not a varchar(256).

Thanks,

Chris

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Alvaro Herrera 2006-05-05 15:04:38 Re: Where to get column length
Previous Message Arnau 2006-05-05 10:05:13 Best way to upgrade Postgresql 7.4.x to 8.1.x?