From: | "Bart van Houdt" <bart(dot)van(dot)houdt(at)syfact(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Data length and data precision |
Date: | 2009-02-06 09:41:04 |
Message-ID: | CECE69D480C32F49891F27ED3E49C38C010DAA68@nthvsexch02.interaccess.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi all,
I'm trying to write some code to make a 'fingerprint' of a database. This to compare a customer database with a reference database of our own.
Therefore I'm trying to retrieve information like this:
-Table name
pg_class.relname where relkind = 'r'
-Column name
pg_attribute where attrelid = pg_class.oid
-Data type
pg_type where oid = pg_attribute.atttypid
-Data length
if pg_attribute.atttypmod = -1 then pg_type.typlen
else pg_attribute.atttypmod
-Data precision
No clue
-Nullable
pg_attribute.attnotnull
As you can see I'm missing the data precision (e.g. numeric (19,2)) and I'm not entirely sure about the data length.
Can anyone tell me where to find the data precision of a column?
And can anyone tell me if I get the data length from the correct places?
Thanks in advance,
Bart
From | Date | Subject | |
---|---|---|---|
Next Message | A. Kretschmer | 2009-02-06 10:04:49 | Re: Data length and data precision |
Previous Message | Raj Mathur | 2009-02-06 06:21:56 | Re: Must I use DISTINCT? |