Subject | Re: [ib-support] Changing metadata in a production database |
---|---|
Author | Tiago Costa |
Post date | 2003-02-13T19:45:53Z |
Jason,
I tried that and it worked ok. Thanks.
But I wondered what would happen if I start a transaction in a
connection, do some updates/inserts, then in another connection, make
the metadata changes and in the first connection (in the same
transaction) use the new fields that connection 2 has created, and the
rollback...
What I found out: (test-case)
CREATE TABLE table1 (id integer, field1 varchar(1));
insert into table1 (id,field1) values (1,'')
Two different connections to the same database (1) and (2)
(1st connection) Start transaction
(1) SELECT * FROM table1
id | field1
-------------
1 | ""
(1) UPDATE table1 SET field1='T' where id=1
(2nd connection) ALTER TABLE table1 add field2 VARCHAR(10)
(1) UPDATE table1 SET field2="test" where id=1
(1) SELECT * FROM table1
id | field1 | field2 |
------------------------
1 | "T" | "test" |
(1) ROLLBACK
(1) SELECT * FROM table1
id | field1 | field2 |
------------------------
1 | "T" | "" |
the "field1" should also be blank...
I know that's **VERY** unprobable to happen, but...
thanks again,
Tiago
Jason Chapman (JAC2) wrote:
Tiago Silva Costa
ECALC Sistemas de Computacao Ltda
Tel:(11)3898-1602 Fax:(11)3063-0359
email: tiago@...
http://www.ecalc.com.br
[Non-text portions of this message have been removed]
I tried that and it worked ok. Thanks.
But I wondered what would happen if I start a transaction in a
connection, do some updates/inserts, then in another connection, make
the metadata changes and in the first connection (in the same
transaction) use the new fields that connection 2 has created, and the
rollback...
What I found out: (test-case)
CREATE TABLE table1 (id integer, field1 varchar(1));
insert into table1 (id,field1) values (1,'')
Two different connections to the same database (1) and (2)
(1st connection) Start transaction
(1) SELECT * FROM table1
id | field1
-------------
1 | ""
(1) UPDATE table1 SET field1='T' where id=1
(2nd connection) ALTER TABLE table1 add field2 VARCHAR(10)
(1) UPDATE table1 SET field2="test" where id=1
(1) SELECT * FROM table1
id | field1 | field2 |
------------------------
1 | "T" | "test" |
(1) ROLLBACK
(1) SELECT * FROM table1
id | field1 | field2 |
------------------------
1 | "T" | "" |
the "field1" should also be blank...
I know that's **VERY** unprobable to happen, but...
thanks again,
Tiago
Jason Chapman (JAC2) wrote:
>No it doesn't cause corruption AFAIK - I do this regularly.--
>
>When we had > 100 concurrent users I used to wait until out of hours, just
>in case I goosed it and had to regress.
>
>JAC.
>
>"Tiago Costa" <tiago@...> wrote in message
>news:3E4BD1CD.1080103@......
>
>
>>Hello,
>>
>> I wonder if it is safe to do several "ALTER TABLE xxx ADD fname type",
>>"DROP INDEX", "CREATE INDEX" in a live database or it can cause
>>
>>
>corruption?
>
>
>>TIA,
>>Tiago
>>
>>
>>
>>
>>To unsubscribe from this group, send an email to:
>>ib-support-unsubscribe@egroups.com
>>
>>
>>
>>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>>
>>
>>
>>
>>
>
>
>
>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>
>
Tiago Silva Costa
ECALC Sistemas de Computacao Ltda
Tel:(11)3898-1602 Fax:(11)3063-0359
email: tiago@...
http://www.ecalc.com.br
[Non-text portions of this message have been removed]