Subject | Can one (repeatedly) restructure a Firebird table in a single transaction? |
---|---|
Author | tvdien@ymail.com |
Post date | 2013-03-24T00:38:22Z |
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?
P.S. Asked on StackOverflow first, so if you prefer, you might as well answer there: http://stackoverflow.com/q/15591799/1163893
- 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?
P.S. Asked on StackOverflow first, so if you prefer, you might as well answer there: http://stackoverflow.com/q/15591799/1163893