Re: Import CSV date issues

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Import CSV date issues
Дата
Msg-id 15362.1362323117@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Import CSV date issues  (Sarfraz Nawaz <sarfraz@gmail.com>)
Ответы Re: Import CSV date issues  (Sarfraz Nawaz <sarfraz@gmail.com>)
Список pgsql-novice
Sarfraz Nawaz <sarfraz@gmail.com> writes:
> However, when I try to import data into "durations" table from a CSV
> file, I get this error which is puzzling me because the date in the
> CSV file is in the same DMY format that the db should be expecting. I
> have also tried by giving "durations(startdate, enddate, ....)" format
> as well but same result.

> mydb=> \copy durations FROM 'myfile.csv' DELIMITER ',' CSV;
> ERROR:  invalid input syntax for type date: "12/09/2011"
> CONTEXT:  COPY durations, line 1, column startdate: "12/09/2011"

That certainly *looks* right, and it does work in testing here.
However, since this is the first column of the first line of the
file, my bet is that you've got some invisible characters at the
start of the file that are screwing up COPY.  Text editors that
think they should put UTF8 "BOM" marks into text files are a
frequent cause of this on Windows.

            regards, tom lane


В списке pgsql-novice по дате отправления:

Предыдущее
От: Francisco Leovey
Дата:
Сообщение: Re: Import CSV date issues
Следующее
От: Sarfraz Nawaz
Дата:
Сообщение: Re: Import CSV date issues