From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Data length and data precision |
Date: | 2009-02-06 10:04:49 |
Message-ID: | 20090206100449.GA25792@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
In response to Bart van Houdt :
> 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?
information_schema.columns, numeric_precision.
http://www.postgresql.org/docs/current/static/infoschema-columns.html
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
From | Date | Subject | |
---|---|---|---|
Next Message | Bart van Houdt | 2009-02-06 10:13:44 | Re: Data length and data precision |
Previous Message | Bart van Houdt | 2009-02-06 09:41:04 | Data length and data precision |