Re: Functions with COPY

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Functions with COPY
Date: 2003-11-28 16:55:43
Message-ID: 28681.1070038543@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> Consider the following input data:
> 1234,24.50,10-Jan-2003,10/1/03,10-01-2003,hiall

> The interpretation for the numbers is:
> 1234 =3D 12.34, 24.50 =3D 24.50
> The interpretation for the dates is:
> January 10th, 2003, October 1st, 2003, October 1st, 2003

> I don't believe it's possible, currently, to correctly import this
> data with copy. I'm not sure the date fields would even be accepted
> as date fields.

Nonsense.

regression=# set datestyle to mdy;
SET
regression=# select '10-Jan-2003'::date;
date
------------
2003-01-10
(1 row)

regression=# select '10/1/03'::date;
date
------------
2003-10-01
(1 row)

regression=# select '10-01-2003'::date;
date
------------
2003-10-01
(1 row)

I think you'd have to do some preprocessing on the numeric inputs if you
wanted implied decimal points inserted like that, but the dates look fine.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2003-11-28 17:00:33 Re: about explain analyze
Previous Message Tom Lane 2003-11-28 16:48:17 Re: about explain analyze