How to delete a table in postgresql

linux, postgresql, sql, ubuntu

Solution

Most probably explanation: some other open transaction is holding an exclusive lock on the table.

You are using pgAdmin, so you can check with `Tools -> Server Status`. The activity pane lists all current connections. For instance, there is one (or more) listings for every open SQL window. Look for long running connections.

You can also try to issue a `DROP TABLE` and check this list. With any luck you'll see what blocks it. Once you have identified the troublemaker and made sure, it's not needed, you might be able to kill the process. Might be vacuuming gone haywire because of bad settings ..

That, or something is seriously broken.

Problem

There is a postgresql installation on my server that worked fine so far. However now there is a single table (all other tables work fine) which I cannot open through pgadmin3 or drop. I've tried restarting the server. Didn't help. I also tried dropping the table with DROP TABLE from the command line on the server. It's just stuck. I've executed the command and it has been just hanging in the console for the past hour. I don't know what to do. Is there a file I could erase in the data directory perhaps?

Original source