아래처럼 트랜잭션을 선언하거나 autocommit 모드가 아니면 alter table 이후 commit 전까지 다른 세션은 blocking 됩니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <세션1> postgres=# begin ; BEGIN postgres=# ALTER TABLE test ADD COLUMN f_rate numeric ; ALTER TABLE <세션2> postgres=# SELECT pid, relation::regclass, locktype, mode, granted FROM pg_locks WHERE locktype = 'relation' ; pid | relation | locktype | mode | granted -------+----------+----------+---------------------+--------- 15084 | pg_locks | relation | AccessShareLock | t 31913 | test | relation | AccessExclusiveLock | t |