5 ms·
I don't agree with you and I'd like some clarification from anyone who knows for sure. If the database is small, then sure, schema changes are harmless. But if
by ionforce 13y ago
I don't agree with you and I'd like some clarification from anyone who knows for sure.
If the database is small, then sure, schema changes are harmless. But if a database is in production with data shuttling in and out of it and has many records, then ALTERs are non-trivial.
And I don't think an ALTER can survive in a transaction, i.e. it is not something that can be rolled back. It can be undone via another ALTER that is it's opposite, but it cannot be rolled back the way INSERT and UPDATE can.
- JonnieCache 13y agopostgres can rollback everything except advancing sequences, and dropping the whole DB.
- wildmXranat 13y agothat is awesome and I admit to not knowing about that. I've been on MySQL and DB2 for some time.
- zwily 13y agoDDL can be rolled back by Postgres in a transaction.
- deleted 13y ago[deleted]
- dragonwriter 13y ago> And I don't think an ALTER can survive in a transaction, i.e. it is not something that can be rolled back. It can be undone via another ALTER that is it's opposite, but it cannot be rolled back the way INSERT and UPDATE can. It can in databases that use transactional DDL (and, really, doing so is part of the relational model, since part of that model is that metadata describing the structure of data is itself stored in relations and -- whatever the syntactic sugar layered over top of it -- can itself be manipulated with the same tools that regular data is manipulated with.)
- ionforce 13y agoHaving the DDL be described relationally is only incidental. I would imagine rollback support to be highly dependent on how the storage engine works. It seems non-trivial to me, short of copying the entire table across the ALTER. And that doesn't sound scalable.