Subject | Re: [Firebird-Architect] the insert into t select * from t infinite |
---|---|
Author | Ann W. Harrison |
Post date | 2005-07-06T15:25:03Z |
Ann W. Harrison wrote:
taken the same database, inverted the order so the highest values appear
first in storage order and re-run the query.
SQL> rollback
CON> ;
SQL> update t set id = 60 - id;
SQL> select count (*) from t;
COUNT
============
50
SQL> delete from t t1 where t1.id in
CON> (select min(t2.id) from t t2);
SQL> select count (*) from t;
COUNT
============
49
Depending on storage order, the same query deletes one row or 50. Not
terribly good. And InterBase does the same thing. And they don't have
a solution because they've made verb undo lists optional.
Regards,
Ann
>>Just in case you think that the results of that delete are correct, I've
> Here's a SQL standard version of the same problem:
>
> SQL> select count (*) from t;
>
> COUNT
> ============
>
> 50
>
> SQL> delete from t t1 where t1.id in
> CON> (select min(t2.id) from t t2);
> SQL> select count (*) from t;
>
> COUNT
> ============
>
> 0
>
taken the same database, inverted the order so the highest values appear
first in storage order and re-run the query.
SQL> rollback
CON> ;
SQL> update t set id = 60 - id;
SQL> select count (*) from t;
COUNT
============
50
SQL> delete from t t1 where t1.id in
CON> (select min(t2.id) from t t2);
SQL> select count (*) from t;
COUNT
============
49
Depending on storage order, the same query deletes one row or 50. Not
terribly good. And InterBase does the same thing. And they don't have
a solution because they've made verb undo lists optional.
Regards,
Ann