Subject | Re: [firebird-support] delete min |
---|---|
Author | Kjell Rilbe |
Post date | 2008-03-19T21:10:58Z |
Helen Borrie wrote:
one record is deleted, and the subquery is reevaluated for the next
record, the previously deleted record is not seen by the subquery, and
so might decide that the next record, although newer, should also be
deleted?
I'm qurious. What does the appropriate SQL standard have to say about
this behavior, and if it says that this is wrong, are there any plans to
change FB to adhere to the standard?
Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64
> >I would have expected this to work:Oh, is this the gotcha where a FB query sees its own effects, i.e. when
> >DELETE
> >FROM MYTABLE T
> >WHERE
> >T.DATE=
> >(SELECT MIN(Q.DATE) FROM
> >MYTABLE Q WHERE T.NUMPAT = Q.NUMPAT )
> >Why doesn't it work? What error do you get?
>
> I would expect it to work, but too well! There's nothing here to prevent
> this statement from continuing to cycle through until it has deleted all
> of the records in the table (except those where NUMPAT or "DATE" were
> NULL). At the very least I would want to test this theory on a copy of
> the database!
one record is deleted, and the subquery is reevaluated for the next
record, the previously deleted record is not seen by the subquery, and
so might decide that the next record, although newer, should also be
deleted?
I'm qurious. What does the appropriate SQL standard have to say about
this behavior, and if it says that this is wrong, are there any plans to
change FB to adhere to the standard?
Kjell
--
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: kjell@...
Telefon: 08-761 06 55
Mobil: 0733-44 24 64