| From: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> | 
|---|---|
| To: | "IanHingley *EXTERN*" <ian(dot)hingley(at)nuvalto(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org> | 
| Subject: | Re: Copy from csv - timestamp issue | 
| Date: | 2013-11-29 13:04:27 | 
| Message-ID: | A737B7A37273E048B164557ADEF4A58B17C6D847@ntex2010a.host.magwien.gv.at | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-novice | 
IanHingley wrote:
> First post here from a total postgresql newbie.  Many years working on SQL
> Server, but ...
> 
> I'm trying to copy in some csv data.
> 
> My first column is, confusingly, called datetime and has datatype timestamp
> without time zone.
> This is followed by flow_m3hr (real), sitename (integer) and pmac (integer).
> 
> Here's my command:
> 
> ST_mpcc=# COPY st_mpcc_data FROM 'C:\blahblah\ST_Mpcc_CSV_sample.csv';
> 
> and here's my error:
> 
> ERROR:  invalid input syntax for type timestamp: "2008-07-11
> 03:00:00,0,10545079
> ,26739"
> CONTEXT:  COPY st_mpcc_data, line 1, column datetime: "2008-07-11
> 03:00:00,0,105
> 45079,26739"
> 
> Does this imply it's trying to place the entire row of data into the first
> field?
> 
> If so, how do I prevent it?
If you want to import CSV, you must tell COPY that because the default
format is different.
COPY ... FROM ... (FORMAT csv);
or, on older releases,
COPY ... FROM ... CSV
Yours,
Laurenz Albe
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Luis E. Arevalo R. | 2013-11-29 13:11:33 | Execute query iterating with different parameter values | 
| Previous Message | IanHingley | 2013-11-29 12:16:32 | Copy from csv - timestamp issue |