My goal is to move my data from mongodb to postgresql 9.1.13.
I used mongoexport
to export my collections from mongodb to csv files. Later I was creating tables with pgAdmin 1.18.1 and importing from csv files using pgAdmin's import.
It worked fine till I reached the csv with datetime fields. In csv file the column (called "start" in my case) has the following format 2014-02-04T19:50:35Z
. The format I have set for the corresponding column in pgAdmin is timestamp without time zone
(I have tried also timestamp with time zone
). What I get from pgAdmin is:
ERROR: invalid input syntax for type timestamp: "start"
CONTEXT: COPY context, line 1, column start_time: "start"
My question is: shall I export from mongodb somehow differently or shall I alter the column type in pgAdmin?
I have checked this, this and this solutions, but not sure what is a good way to go, because I am going to have more imports from mongodb and want to use the most standard, universal timestamps format and avoid defining custom datetime formats.
P.S. I am a noob in SQL and postgres.