Skip to content Skip to sidebar Skip to footer

Why Does Having No Autocommit Facility Mean That All Queries Execute Within A Transaction In Postgresql?

From https://wiki.postgresql.org/wiki/Psycopg2_Tutorial PostgreSQL does not have an autocommit facility which means that all queries will execute within a transaction. Execution

Solution 1:

All the 3 are related to Python and its DB connector library, not the PostgreSQL itself:

  1. PostgreSQL has an autocommit and it is active by default - which means that every SQL statement is immediately executed. When you start a transaction block, this autocommit mode is disabled until you finish the transaction (either by COMMIT or ROLLBACK)
  2. The operation of destroying a database is implemented in a way where you can not run it from inside a transaction block. Also keep in mind that unlike most other databases PostgreSQL allows almost all DDL statements (obviously not the DROP DATABASE one) to be executed inside a transaction.
  3. Actually you can not drop a database if anyone (including you) is currently connected to this database - so it does not matter what is your isolation level, you still have to connect to another database (e.g. postgres)

Post a Comment for "Why Does Having No Autocommit Facility Mean That All Queries Execute Within A Transaction In Postgresql?"