ERROR: could not stat file “XX.csv”: Unknown error

后端 未结 5 536
我在风中等你
我在风中等你 2020-12-16 14:43

I run this command:

COPY XXX FROM \'D:/XXX.csv\'  WITH (FORMAT CSV, HEADER TRUE, NULL \'NULL\')

In Windows 7, it successfully imports CSV f

5条回答
  •  长情又很酷
    2020-12-16 15:17

    You can work around this by piping the file through a program. For example I just used this to copy from a 24GB file on Windows 10 and PostgreSQL 11.

    copy t(c,d) from program 'cmd /c "type x:\path\to\file.txt"' with (format text);
    

    This copies the text file file.txt into the table t, columns c and d.

    The trick here is to run cmd in a single command mode, with /c and telling it to type out the file in question.

提交回复
热议问题