Subject | Re: [ib-support] Changing metadata in a production database |
---|---|
Author | Tiago Costa |
Post date | 2003-02-14T11:55:51Z |
Jason,
I'm using the "Database Explorer" that comes with delphi. So, I'm
connecting via BDE.
I did not commit any changes... Only rollback
What I found is that if I don't change "field2" and rollback, it works
(field1 return to ""), but if i update field2 in the same transaction (i
didn't commit, or rollback), looks like that bde commit my changes and
starts a new transaction...
(1) Start transaction
(1) SELECT * FROM table1 (field1 "")
(1) UPDATE table1 SET field1='T' where id=1
(2) ALTER TABLE table1 add field2 VARCHAR(10)
(1) UPDATE table1 SET field2="test" where id=1
(*) - I think BDE here COMMIT and Starts another transaction
(1) SELECT * FROM table1 (both fields "T" and "test")
(1) ROLLBACK
(1) SELECT * FROM table1 (field1 "T")
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'm using the "Database Explorer" that comes with delphi. So, I'm
connecting via BDE.
I did not commit any changes... Only rollback
What I found is that if I don't change "field2" and rollback, it works
(field1 return to ""), but if i update field2 in the same transaction (i
didn't commit, or rollback), looks like that bde commit my changes and
starts a new transaction...
(1) Start transaction
(1) SELECT * FROM table1 (field1 "")
(1) UPDATE table1 SET field1='T' where id=1
(2) ALTER TABLE table1 add field2 VARCHAR(10)
(1) UPDATE table1 SET field2="test" where id=1
(*) - I think BDE here COMMIT and Starts another transaction
(1) SELECT * FROM table1 (both fields "T" and "test")
(1) ROLLBACK
(1) SELECT * FROM table1 (field1 "T")
Tiago
Jason Chapman (JAC2) wrote:
>Tiago,--
>
>Unfortunately I think your test script is ambiguous as it does not say when
>to commit changes.
>
>I ran through your tests as follows and unless I commit (1) after the select
>and before the update (i.e. after (2) has added the column and committed) I
>get the error:
>Dynamic SQL Error.
>SQL error code = -206.
>Column unknown.
>FIELD2.
>At line 1, column 19.
>
>Can you give me the test again with:
>1) The transaction isolation level
>2) The commits e.g. (1) commit
>3) The start transaction (in most tools the point of start is the first
>command after a commit).
>
>What tool are you using?
>
>Cheers,
>
>JAC
>
>"Tiago Costa" <tiago@...> wrote in message
>news:3E4BF5F1.3050608@......
>
>
>>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:
>>
>>
>>
>>>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]
>>
>>
>>
>>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]