Re: COPY statement REAL vs VARCHAR precision issue

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Samuel Gilbert <samuel(dot)gilbert(at)ec(dot)gc(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: COPY statement REAL vs VARCHAR precision issue
Date: 2011-02-10 19:43:43
Message-ID: 4D543FEF.5030904@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/02/2011 17:13, Samuel Gilbert wrote:
> Hello all,
>
> I'm using a COPY statement to load data into a PostGIS. The issue I am
> facing is that if I define fields with the REAL type, the COPY will only
> preserve 4 decimals which is not sufficient for my application.

If you use NUMERIC, you can define the precision you need, and be sure
of accurate calculations:

http://www.postgresql.org/docs/9.0/static/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Royce Ausburn 2011-02-10 21:38:27 Schema version control
Previous Message Scott Ribe 2011-02-10 19:02:15 finding bogus UTF-8