PostgreSQL: Table level locks

Type of lock   Access share Row share Row exclusive Share update exclusive Share Share row exclusive Exclusive Access exclusive
  Commands
SELECT
ANALYZE
SELECT FOR UPDATE
UPDATE
DELETE
INSERT
VACUUM w/o FULL
CREATE INDEX
-
-
ALTER TABLE
DROP TABLE
REINDEX
CLUSTER
VACUUM FULL
Access share
SELECT
ANALYZE
              X
Row share
SELECT FOR UPDATE
            X X
Row exclusive
UPDATE
DELETE
INSERT
        X X X X
Share update exclusive
VACUUM w/o FULL
      X X X X X
Share
CREATE INDEX
    X X   X X X
Share row exclusive
-
    X X X X X X
Exclusive
-
  X X X X X X X
Access exclusive
ALTER TABLE
DROP TABLE
REINDEX
CLUSTER
VACUUM FULL
X X X X X X X X
Legend:
 X  If a transaction holds one table lock, and another transaction requires the other lock, then the second transaction will be blocked until the first transaction ends (eg. by COMMIT or ROLLBACK).
 X  same as above, but those lock types are not used by PostgreSQL