CREATE TABLE in Postgres locks pg_class forever I have a PostgreSQL cluster with few databases. In one of the DBs, if I try to create a new table, the command never ends until I kill the the linux proccess. I checked pg_lock and found that pg_class and the indexes on pg_class are locked, lock type is relation and mode is RowExclusiveLock.
I can add a column to a table but cannot create an index on a table.

If I create a table in another database, there are no locks on pg_class.

Every hint can help.

Here there is description of locks:

relname                             locktype    mode    
pg_class_tblspc_relfilenode_index   relation    RowExclusiveLock
pg_class_relname_nsp_index          relation    RowExclusiveLock
pg_class_oid_index                  relation    RowExclusiveLock
pg_class                            relation    RowExclusiveLock
Normal operations don't place a persistent lock on pg_class.

There must be a DDL command (CREATE TABLE, DROP TABLE or similar) that is blocked because of a lock, so that it cannot complete the operation.

Check for active sessions in pg_stat_activity, their query and if they are hanging.

Your CREATE TABLE is not blocked by a table lock, but by a row lock in pg_class.