I do experience the following situation on a PostgreSQL 11:
- A transaction with unknown statements creates an
ACCESS SHARElock on
- Another connection wants to execute
DROP TABLEwhich causes an
ACCESS EXCLUSIVElock on
pg_class. This operation is blocked because operation #1 still holds the lock.
- Following that any new connection to the DB is waiting forever, because it needs to access
The only way to proceed is to either kill operation #1 or #2.
While I can reproduce the situation with manual locking the tables, I do not find an explanation what causes the
pg_class lock on operation #1. That is,
pg_stats_activity only shows a
SELECT as current query which is
idle in transaction. I suspect this not being the statement creating the lock, however.
Thus, any input on what could cause
ACCESS SHARE locks on
DROP TABLE is highly appreciated.
Update atm it is also unclear why
DROP TABLE wants to lock