0

I make table:

CREATE TABLE data (
date    date,
time    time,
val3    float,
val4    float);

And trying to load csv to it with next command:

copy data from 'G:\test\1.txt' DELIMETERS ' ' CSV;

the CSV have same structure:

date time val3 val4 
2012.08.10 06:53:18 695.417 773.29

But I am getting next error:

ERROR: invalid input syntax for type date: "date"

Could you help me to find the reason of error?

2 Answers 2

1

I'm not very used to postgres, but I think you should set your datestyle before importing your file :

set datestyle German, YMD;

Look at these links : How do I alter the date format in Postgres? and DateTime Output

Sorry if I'm wrong, but I think you have to correctly set your datestyle (you can also do in the postgres.cnf file).

Sign up to request clarification or add additional context in comments.

2 Comments

It is better to use links to current version of postgres manual. /docs/current/static instead of /docs/8.2/static.
I had tried this command several times. It does not work with quote symbol. Plz look at my log postimg.org/image/51n25xr0z
0

Do you have a header line in your CSV? If so, try

copy data from 'G:\test\1.txt' DELIMETERS ' ' CSV HEADER;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.