"truncate all"?

Поиск
Список
Период
Сортировка
От Andreas
Тема "truncate all"?
Дата
Msg-id 5.2.0.9.0.20030804112330.00b55840@pop.chello.at
обсуждение исходный текст
Ответы Re: "truncate all"?  ("Shridhar Daithankar" <shridhar_daithankar@persistent.co.in>)
Список pgsql-hackers
Hi!
Would it be possible to implement a "truncate all" that purges all tuples 
from *all* tables, without taking account any rules or triggers, but 
leaving all table structures and rules, triggers, functions, etc intact 
(sequences do not need to reinitialized)?

As far as I understand, the "no truncate if table is referenced" change was 
introduced to ensure database integrity. However, if the referencing table 
is truncated, too, there should be no problem as far as foreign keys are 
concerned, correct?

The rationale behind this suggestion is that in our project we need a 
*quick* way to get rid of all the tuples in all tables in order to 
accelerate the reinitialization of the database for our unit tests. This 
needs to be done fairly often, and so the quicker the unit tests run, the 
easier it will be to include many unit tests in our project, thus ensuring 
that we can develop efficiently and safely in postgresql.

If you know of some other *quick* way to truncate all tables, please let us 
know. BTW: Starting and later rolling back a transaction will not work, as 
we also need to check whether the correct exceptions are raised. This "all" 
option to "truncate" would really help to accelerate unit tests (besides of 
making them more readable) and should be fairly easy to implement, but I am 
not sure how to change the relevant postgresql code. I would be glad if 
someone could suggest some easy way to do it, and what needs to be observed 
to implement such an extension of postgresql. I also hope that such an 
extension could be included in future version of postgresql, but for now 
some easy patch to the latest version would do as well.
    Thanks for your time,                Andi.




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andreas Pflug
Дата:
Сообщение: Re: Release changes
Следующее
От: "Shridhar Daithankar"
Дата:
Сообщение: Re: "truncate all"?