List:General Discussion« Previous MessageNext Message »
From:Sebastian Mendel Date:January 9 2008 10:47am
Subject:Re: why in procedure truncate table do not reset auto_increment?
View as plain text  
Martijn Tonies schrieb:
> 
>>>>>>> [...] why in procedure TRUNCATE table
>>>>>>> demo do not reset auto_increment?
>>>>>> is clearly written in the documentation, just read ...
>>>>>>
>>>>>> in short:
>>>>>>
>>>>>> auto_increment is used for primary key, primary keys could be
>>>>>> referenced
>>>>>> from another table, setting auto_increment back to 0 could lead
> to
>>>>>> using a
>>>>>> primary key formerly used by another datarow and still referenced
> by
>>>>>> another
>>>>>> table - could lead to data inconsistency.
>>>>> lol, but TRUNCATE empties the table... What good are your
> references?
>>>> it is better to have references leading to 'nothing' than to a wrong
>>>> datarow
>>>> ... i think this is very easy to understand - better save than sorry!
>>> Why is a row with an invalid reference better? It's invalid data and you
>>> just corrupted your database.
>> please define 'invalid' - i think invalid is it in booth cases, so an empty
>> invalid is better than a wrong invalid, or not?
> 
> IMO, you're f***ed in both cases :-)
> 
>> better have an unpayed bill leading to no costumer than to a wrong customer
> 
> Why is that better? If you TRUNCATEd the table, you know you're doing
> something wrong/your data is messed up.

yes, but this was not the point of the discussion

the point was why is auto_increment not reset - and the above is the reason
for this - i was not discussing if this is good or bad, or if it is good to
delete table content, or if the table content was deleted by accident


> As I said, what I wanted to point out is that this piece in the
> documentation is a bit strange.

yes, i have read it ... ;-)


-- 
Sebastian
Thread
why in procedure truncate table do not reset auto_increment?过客7 Jan
  • Re: why in procedure truncate table do not reset auto_increment?Sebastian Mendel9 Jan
    • Re: why in procedure truncate table do not reset auto_increment?x9 Jan
      • Re: why in procedure truncate table do not reset auto_increment?Sebastian Mendel10 Jan
  • Re: why in procedure truncate table do not reset auto_increment?Martijn Tonies9 Jan
    • Re: why in procedure truncate table do not reset auto_increment?Sebastian Mendel9 Jan
  • Re: why in procedure truncate table do not reset auto_increment?Martijn Tonies9 Jan
    • Re: why in procedure truncate table do not reset auto_increment?Sebastian Mendel9 Jan
  • Re: why in procedure truncate table do not reset auto_increment?Martijn Tonies9 Jan
    • Re: why in procedure truncate table do not reset auto_increment?Sebastian Mendel9 Jan