2 ms·
Yes almost all DDL is transactional in PG, and it works as you say. You can create tables, drop indexes, replace functions, update views - and then roll it all
by doctor_eval 7y ago
Yes almost all DDL is transactional in PG, and it works as you say. You can create tables, drop indexes, replace functions, update views - and then roll it all back.
There are a very small number of DDL statements that you can’t do in a transaction, but the devs are fixing them (adding a value to an enum is the only one that comes to mind)
We use it to great effect when upgrading schemas.
- pritambaral 7y ago> adding a value to an enum is the only one that comes to mind Adding enum values in a transaction is now supported in PG 12 as long as you don't try to use the new value in the same transaction.