Hacker News new | past | comments | ask | show | jobs | submit login

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.




> 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.)


Having 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.


postgres can rollback everything except advancing sequences, and dropping the whole DB.


that is awesome and I admit to not knowing about that. I've been on MySQL and DB2 for some time.


DDL can be rolled back by Postgres in a transaction.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: