List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:January 9 2008 9:34am
Subject:Re: why in procedure truncate table do not reset auto_increment?
View as plain text  
> >>> [...] 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?
:-)
>
> LOL ??? very funny, really
>
> why not read the manual before posting? could help me save a lot of time
...

You don't have to answer if you want to save time :-)

> only one table is truncated, not the one referencing to this one

I know that.

> 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.

The point I'm trying to make is that this part of the documentation is a bit
strange, to say at least.

The only benefit I could thing of, is being able to re-fill the table with
the
original data, but then your auto-inc should be turned OFF in between the
mass INSERT and normal operations.



Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

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