Re: problems importing from csv

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: stan <stanb(at)panix(dot)com>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: problems importing from csv
Date: 2019-09-20 04:01:28
Message-ID: CAHOFxGpHx8fPu-hJ9Qtimppc8LQisaUEYsYBcLKiYTU1=UO8Hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>I am trying to import some data from spreadsheets. Included in the data
>sets are US monetary values. These appear in the CSV file, like this: $1.00
>The column is defined like this: NUMERIC(5,2) NOT NULL.

1) remove all $ characters from csv before import
OR
2) import into text field (perhaps in a temp table), remove $ characters,
cast value and insert into numeric field

By the way, there may be no benefit to specifying a max value of 99,999.99
if you can foresee a potential need for bigger values. For values that fit,
numeric(1000,2) will store numbers in the same bytes as a numeric(5,2)
field will. It just won't throw an error if large values are used in the
future.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message stan 2019-09-20 10:30:31 Re: FW: Re: FW: Re: Shouldn;t this trigger be called?
Previous Message rob stone 2019-09-20 01:45:11 Re: PGPASSWORD in crypted form, for example BlowFish or SHA-256