0
我的表有一個NOT NULL列與DEFAULT CLOCK_TIMESTAMP()稱爲'created'。我有意複製的CSV文件沒有名爲'created'的列,因爲我希望數據庫使用它的默認值。我的複製命令是:不能複製到postgresql表,其中有默認clock_timestamp
\copy table_name from '/local/path/to/file.csv' delimiter ',' CSV HEADER
我收到的錯誤是:
missing data for column "created_"
PostgreSQL的文件說:「如果有表不在列列表的列,COPY FROM會插入這些列的默認值。「
感謝所有幫助
這奏效了 - 我以爲頭關鍵字只是告訴它使用CSV標題列作爲我的列表。也許我會發送文件澄清請求... – SplendidSplinter