Re: copy command - date - Mailing list pgsql-general

From novice
Subject Re: copy command - date
Date
Msg-id ddcb1c340708121849k59399ca6i4496129ac4d0e7c8@mail.gmail.com
Whole thread Raw
In response to Re: copy command - date  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: copy command - date  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: copy command - date  (Paul Lambert <paul.lambert@autoledgers.com.au>)
Re: copy command - date  (Michael Glaesemann <grzm@seespotcode.net>)
List pgsql-general
I'm using pg version 8.2.4.  What is the best method to load this data?
I have just a little over 55,000 entries.

db5=>  \copy maintenance FROM test.txt
ERROR:  invalid input syntax for integer: "3665   OK           SM
07/07/13 06:09"
CONTEXT:  COPY maintenance, line 1, column maintenance_id: "3665   OK
         SM 07/07/13 06:09"

                                              Table "pm.maintenance"
     Column      |           Type           |
    Modifiers
-----------------+--------------------------+----------------------------------------------------------------------
 maintenance_id  | integer                  | not null default
nextval('maintenance_maintenance_id_seq'::regclass)
 meter_id        | integer                  |
 status          | character(3)             |
 inspector       | character(2)             |
 inspection_date | timestamp with time zone |



On 13/08/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> novice <user.postgresql@gmail.com> writes:
> > I'm having trouble loading the date field.  Should I convert it first
> > or should I be using a text processor before loading the data in?
>
> > 3665   OK           SM 07/07/13 06:09
> > 5162   OK           SM 07/02/12 06:10
> > 3665   OK           SM 07/06/19 06:10
>
> What sort of trouble, exactly?
>
> I'm guessing that you might need to set DateStyle to tell Postgres what
> the date field ordering is, but without seeing any error messages that's
> strictly a guess.
>
>                         regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: copy command - date
Next
From: Tom Lane
Date:
Subject: Re: copy command - date