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

后端 未结 5 528
我在风中等你
我在风中等你 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:14

    For anyone else who googled this Postgres error message after attempting to work with a >1gb file in Postgres 11, I can confirm that @亚军吴's answer above is spot-on. It is indeed a size issue.

    I tried a different approach, though, than @亚军吴's and @Loren's: I simply uninstalled Postgres 11 and installed the stable version of Postgres 10.7. (I'm on Windows 10, by the way, in case that matters.)

    I re-ran the original code that had prompted the error and voila, a few minutes later I'd filled in a new table with data from a medium-ish-size csv file (~3gb). I initially tried to use CSVSplitter, per @Loren, which was working fine until I got close to running out of storage space on my machine. (Thanks, Battlefield 5.)

    In my case, there isn't anything in PGSQL 11 that I was relying on that wasn't in version 10.7, so I think this could be a good solution for anyone else who runs into this problem. Thanks everyone above for contributing, especially to the OP for posting this in the first place. I cured a huge, huge headache!

提交回复
热议问题