Brian Faherty <anothergenericu...@gmail.com> writes: > If a postmaster is running and the pg_control file is removed postgres > will PANIC.
That's very intentional. Don't do it. > There does not really seem to be a need for this behavior as all the > information postgres needs is in memory at this point. I propose with > a patch to just recreate pg_control on updates if it does not exist. I would vote to reject any such patch; it's too likely to cause more problems than it solves. Generally, if critical files like that one have disappeared, trying to write new data isn't going to be enough to fix it and could well result in more corruption. As an example, imagine that you do "rm -rf $PGDATA; initdb" without remembering to shut down the old postmaster first. Currently, the old postmaster will panic/quit fairly promptly and no harm done. The more aggressive it is at trying to "recover" from the situation, the more likely it is to corrupt the new installation. (Note that you would have to break a few other things in order to make this particular scenario actually hazardous. My point is just that there *are* reasons not to try to recover automatically.) regards, tom lane