I use postgres from homebrew in my OS X, but when I reboot my system, sometimes the postgres doesn't start after the reboot, and so I manually tried to start it with postgres -D /usr/local/var/postgres
, but then the error occurred with the following message: FATAL: could not open directory "pg_tblspc": No such file or directory
.
The last time it occurred, I couldn't get it to the original state, so I decided to uninstall the whole postgres system and then re-installed it and created users, tables, datasets, etc... It was so disgusting, but it frequently occurs on my system, say once in a few months.
So why does it lose the pg_tblspc
file frequently? And is there anything that I can do to avoid the loss of the file?
I haven't upgraded my homebrew and postgres to the latest version (i.e. I've been using the same version). Also, all the things that I did on the postgres database is delete the table and populate the new data every day. I haven't changed the user, password, etc...
EDIT (mbannert): I felt the need to add this, since the thread is the top hit on google for this issue and for many the symptom is different. Homebrewers likely will encounter this error message:
No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
So, if you just experienced this after the Yosemite upgrade you now you're covered for now reading this thread.
pg_tblspc
is a directory. The only way I can see this directory and just this directory randomly vanishing is filesystem corruption or a particularly badly behaved virus scanner or file sync tool. – Craig Ringertablespaces
is, so I don't think I put it on external storage. – Blaszardpg_tblspc
does not just disappear on any system I've ever encountered, nor can I imagine a sane reason it would. It's going to be very hard to say what makes your system different without a lot more detail. – Craig Ringer