2014-10-17 64 views
1

我想一些的.csv數據導入到Postgres的,並有一個數據類型的問題:將.csv導入到postgres。如何處理時間?

我的屬性之一是生日:

  1968-06-24 00:00:00 

所以我使用時間戳,由pgmodeler建議。不過,我總是得到消息:

postgres=# \connect new_database 
    You are now connected to database "new_database" as user "postgres". 
    new_database=# \copy players FROM '/Users/Desktop/Rdaten/Data/players.csv' DELIMITER ';' CSV HEADER 

錯誤:

ERROR: invalid input syntax for type timestamp: "NULL" 
    CONTEXT: COPY players, line 267, column birthday: "NULL" 
    new_database=# 

我能做些什麼呢?

+3

你可以給一個完整的csv行樣本?而你的目標表數據結構? – Houari 2014-10-19 22:06:45

回答

0

不知道這是否是同一個問題,但我得到了這個錯誤試圖導入一個CSV空值被列爲'NULL'並通過向複製命令添加「空'NULL'」來修復它默認Postgres期望NULL值被輸入爲空字符串。