1

I'm trying to copy data from a 8GB txt file into a table in Postgres 13 using Windows 10 psql prompt. The command I'm using is:

\copy PERSON1 FROM 'D:\final3\FINAL\FINAL.txt' (DELIMITER('|'));

And I'm getting this error:

Can not stat file «D:/final3/FINAL/FINAL.txt»: value too large

Any idea of how to modify the max size of copy in psql13?

myge32
  • 75
  • 8
  • I do not find that error message in the Postgres code. I believe this is coming from the OS. Take a look at this SO [question](https://stackoverflow.com/questions/53523051/error-could-not-stat-file-xx-csv-unknown-error) – Adrian Klaver Oct 03 '20 at 15:41
  • Does this answer your question? [ERROR: could not stat file "XX.csv": Unknown error](https://stackoverflow.com/questions/53523051/error-could-not-stat-file-xx-csv-unknown-error) – Adrian Klaver Oct 03 '20 at 15:48

2 Answers2

1

Add two lines to your txt file: One at the begining and one at the end:

COPY PERSON1 FROM STDIN ( DELIMITER '|' );
<here are the lines your txt file already contains>
\.

Don't forget another newline after the \. line. Then call

psql -h *hostname* -d *dbname* -U *username* -f 'D:\final3\FINAL\FINAL.txt'
S1010
  • 11
  • 2
0

I got similar error after new installation of pgAdmin 4 v4. When I returned to Postgres 9.6 in bin\ psql version nothing like that happen.