Solvedmimic code Could not stat file chartevents.csv unknown error


When I run Postgres_load_data script, first three table are loaded and after that I got message: could not stat file CHARTEVENTS.csv: unknown error. Is anyone has this situation and can help.

27 Answers

✔️Accepted Answer

Okay, the could not stat file "CHARTEVENTS.csv": Unknown error is actually a bug in PostgreSQL 11. Under the hood it makes a call to fstat() to make sure the file is not a directory, and unfortunately fstat() is a 32-bit program which can't handle large files like chartevents. I tested the build on Windows with PostgreSQL 10.5 and I didn't get this error so I think it's fairly new.

The best workaround is to keep the files compressed (i.e. keep them as .csv.gz files) and use 7zip to load in the data directly from compressed files. In testing this seemed to still work. There is a pretty detailed tutorial on how to do this here:

The brief version of above is that you keep the .csv.gz files, you add the 7zip binary to your windows environment path, and then you call the postgres_load_data_7zip.sql file to load in the data. You can use the postgres_checks.sql file after everything to make sure you loaded in all the data correctly.

edit: For your later error, where you are using this 7zip approach, I'm not sure why it's not loading. Try redownloading just the ADMISSIONS.csv.gz file and seeing if it still throws you that same error. Maybe there is a new version of 7zip which requires me to update the script or something!

Other Answers:

Thank you for detail explanation. I installed PostgreSQL 10.5 and now process is running. I think it will take a lot of time to load all table but I do not get "Unknown error" anymore. Thank you very much for all help.

Related Issues:

mimic code Could not stat file chartevents.csv unknown error
Okay the could not stat file CHARTEVENTS.csv: Unknown error is actually a bug in PostgreSQL 11 ...
js lingui [Epic] Road to LinguiJS v3
Hey everyone Documentation Migration guide Examples: Node.js Create React App Next.js Note: Original...
js lingui "Duplicate declaration" error when running "lingui extract" with NODE_ENV=production
I updated to @lingui/cli 3.7.1 and babel-plugin-macros 3.0.1 but I'm still seeing this issue. ...
js lingui Improve JS macro
What about this? This was early proposal of macros. Is your feature request related to a problem? Co...