Re: "truncate all"? - Mailing list pgsql-hackers

From Andreas
Subject Re: "truncate all"?
Date
Msg-id 5.2.0.9.0.20030805100722.00b4beb8@pop.chello.at
Whole thread Raw
In response to "truncate all"?  (Andreas <e9625203@student.tuwien.ac.at>)
Responses Re: "truncate all"?
Re: "truncate all"?
List pgsql-hackers
Hi there,
> I agree with Tom ... even the idea of a "TRUNCATE ALL" makes me nervous.  If> we had such a feature, I'd advocate
thatit be superuser only.
 

This "superuser only" restriction certainly would be sensible.
> As for "TRUNCATE CASCADE" or similar improvements, I agree that they 
could be> convenient ... but are easily worked around currently.

Agreed, workarounds are easy. The original suggestion of "TRUNCATE ALL"
(or "TRUNCATE table CASCADE"), however, was motivated by the search for a
simple and efficient truncation of all tables to accelerate unit-testing.
Obviously, a plain "TRUNCATE" without arguments that truncates all tables
would be dangerous, and in order to stay consistent with current psql
syntax, I would say that an efficient "TRUNCATE table [CASCADE|RESTRICT]",
with the "RESTRICT" option being the default, would be totally sufficient
to satisfy the original motivation.

Another way to specify a safe but efficient "TRUNCATE ALL" command that
might be easier to implement than above "TRUNCATE table
[CASCADE|RESTRICT]"  might be to implement the functionality of the
originally suggested "TRUNCATE ALL" through a psql meta-command. Any
suggestions for a safe syntax of such a "TRUNCATE ALL" meta-command? How
about "\rtuples *"?
>   So I wouldn't object to putting TRUNCATE CASCADE on the todo list, but> would argue that it be left to the people
whoasked for it to implement> it.
 

Before attempting to implementing any such extension, we would like to
make sure that that extension would not be rejected by those of you who
decide what goes into future versions of postgresql.
    Yours,        Andi.




pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: DROP TYPE/DROP DOMAIN
Next
From: "Jinqiang Han"
Date:
Subject: win32 porting in 7.4