PgAdmin freezes when trying to delete a table from the database

0

I have problems with a table in my database which was linked to geoserver. The layer was removed from geoserver but the table is still in the database. When you try to delete it with DROP TABLE, the program freezes, in fact just by touching the table with the mouse, the program freezes and you just have to close it. Does anyone know in what way this can be solved? Thank you very much!

    
asked by Felix 16.09.2016 в 17:05
source

1 answer

0

It's an old question but recently something similar happened to me. A couple of points that can help.

Removing a layer from geoserver does not delete the table. A layer is just a certain representation of a data source (a shapefile, a raster, a view, a table, ...) in geoserver. Deleting it does not eliminate the data source.

In these situations, there is most likely a lock on the table. That is, a query or a session that is using it exclusively.

The grossest solution is usually to restart. If it is not feasible, you have to find out if the table is indeed blocked:

SELECT pid, relname
FROM pg_locks l
JOIN pg_class t ON l.relation = t.oid AND t.relkind = 'r'
WHERE t.relname = 'MI_TABLA';

If a result comes out, it is blocked and the blocking process can be killed with:

kill -9 EL_PID

As indicated in this answer , there may also be a pending prepared transaction :

SELECT database, gid FROM pg_prepared_xacts;
ROLLBACK PREPARED 'EL_GID'
    
answered by 21.07.2018 в 12:29