Re: "truncate all"?

From: Andreas <e9625203(at)student(dot)tuwien(dot)ac(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Cc: josh(at)agliodbs(dot)com
Subject: Re: "truncate all"?
Date: 2003-08-05 08:10:22
Message-ID: 5.2.0.9.0.20030805100722.00b4beb8@pop.chello.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 that it 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 who asked 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.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lee Kindness 2003-08-05 08:27:14 Re: Thread-safe configuration option appears to
Previous Message Christopher Kings-Lynne 2003-08-05 08:05:35 Re: DROP TYPE/DROP DOMAIN