Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Does Postgres log implicit transactions?

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Are implicit transactions excluded from logs?

Related: Does Postgresql implicitly wrap select statements in transaction?

>Solution :

Does Postgres log implicit transactions?

No.

The logs show explicit SQL statements from clients. The implicit transactions around standalone statements weren’t controlled by statements, so BEGIN and COMMIT don’t turn up in the logs.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading