Re: problems importing from csv - Mailing list pgsql-general

From Michael Lewis
Subject Re: problems importing from csv
Date
Msg-id CAHOFxGpHx8fPu-hJ9Qtimppc8LQisaUEYsYBcLKiYTU1=UO8Hg@mail.gmail.com
Whole thread Raw
In response to Re: problems importing from csv  (Adrian Klaver <adrian.klaver@aklaver.com>)
List 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.

pgsql-general by date:

Previous
From: rob stone
Date:
Subject: Re: PGPASSWORD in crypted form, for example BlowFish or SHA-256
Next
From: stan
Date:
Subject: Re: FW: Re: FW: Re: Shouldn;t this trigger be called?