Postgres docs state
PostgreSQL actually treats every SQL statement as being executed within a transaction. If you do not issue a BEGIN command, then each individual statement has an implicit BEGIN and (if successful) COMMIT wrapped around it. A group of statements surrounded by BEGIN and COMMIT is sometimes called a transaction block.
SELECT
statement logs aren't wrapped in BEGIN
and COMMIT
when I set log_statement='all'
(as per How to log PostgreSQL queries?). INSERT
logs, on the other hand, are wrapped in BEGIN
and COMMIT
.
Are implicit transactions excluded from logs?
Related: Does Postgresql implicitly wrap select statements in transaction?