问题
Normally, I'd do a relatively complicated change of data type on column A like this:
- Create column B of the new data type
- Set B to contain the new values derived from A
- Drop A
- Rename B to A
To guarantee the validity of my data model, I'd like to perform such restructuring within a single transaction. So far, I have not been able to do that, because, depending on the isolation level, either B is not considered to exist yet, or I'm not allowed to rename B ("update conflicts with concurrent update"), or no errors occur but B is empty. Is it possible to perform to do what I ask - I'd love to see how - or is it absolutely required to COMMIT
in between?
回答1:
After searching using apparently more appropriate search terms (metadata), as well as via de Firebird support groups, I found that this is clearly not possible. The workaround is to do the migration in steps and combine it with backups (never a bad idea).
来源:https://stackoverflow.com/questions/15591799/can-one-repeatedly-restructure-a-firebird-table-in-a-single-transaction