Gurjeet Singh <singh.gurjeet@gmail.com> writes:
> We are facing a problem in dropping a tablespace after crash recovery. The
> recovery starts from the last checkpoint, but the tables that were created
> by
> a transaction in a tablespace before the checkpoint are still lying around;
> the
> transaction had not finished by the time of crash.
> After recovery, when the app tries to drop the tablespace, the command fails
> because the tablespace directory is not empty.
Hmm. The reason DROP TABLESPACE fails in that case, rather than just
arbitrarily rm -rf'ing the files, is fear of deleting valuable data by
accident. I suppose we could have a mode that deletes the files without
any manual intervention, but personally I'd regard that as a foot-gun.
> Solving this problem has become quite critical since the the platform where
> Postgres is being used is supposed to run unattended.
I'm not entirely clear as to the use-case for unattended DROP TABLESPACE?
That doesn't really seem like an operation you should need on a routine
basis.
regards, tom lane