I am trying find out what is postgres can handle safely inside of transaction, but I cannot find the relavant information in the postgres manual. So far I have found out the following:
UPDATE,INSERTandDELTEare fully supported inside transactions and rolled back when the transaction is not finishedDROP TABLEis not handled safely inside a transaction, and is undone with aCREATE TABLE, thus recreates the dropped table but does not repopulate itCREATE TABLEis also not truly transactionized and is instead undone with a correspondingDROP TABLE
Is this correct? Also I could not find any hints as to the handling of ALTER TABLE and TRUNCATE. In what way are those handled and are they safe inside transactions? Is there a difference of the handling between different types of transactions and different versions of postgres?
Best I’m aware all of these commands are transaction aware, except for
TRUNCATE ... RESTART IDENTITY(and even that one is transactional since 9.1.)See the manual on concurrency control and transaction-related commands.