Re: about truncate

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Subject: Re: about truncate
Date: 2008-12-30 19:36:17
Message-ID: 200812301936.mBUJaHT23768@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David Fetter wrote:
> > My vote is to just go ahead and change it. I don't really see much
> > of a use-case for truncating only the parent of an inheritance
> > hierarchy anyway, so I doubt that many people would be affected.
>
> Here's one such use-case. Let's say a table has gotten large and
> you've decided to partition it. You add child tables, add one or more
> triggers to the parent table to make sure it never gets a row,
> populate the child tables from the parent table, then you want to
> remove all the rows from the parent table.
>
> TRUNCATE ONLY handles this case just fine, so long as there's a clear
> message in the release notes. :)

Agreed. The good thing is that I don't imagine what you have described
above would be scripted so someone would be typing that and hopefully
know the current behavior.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-30 19:58:50 Re: TODO items for window functions
Previous Message David Fetter 2008-12-30 19:00:59 Re: about truncate