Re: [PATCHES] TRUNCATE TABLE with IDENTITY

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Neil Conway <neilc(at)samurai(dot)com>, Zoltan Boszormenyi <zb(at)cybertec(dot)at>, List pgsql-patches <pgsql-patches(at)postgresql(dot)org>, "Decibel!" <decibel(at)decibel(dot)org>, Steve Crawford <scrawford(at)pinpointresearch(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] TRUNCATE TABLE with IDENTITY
Date: 2008-07-01 18:09:28
Message-ID: 200807011809.m61I9SR02927@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Alvaro Herrera wrote:
> Tom Lane wrote:
>
> > 2. I had first dismissed Neil's idea of transactional sequence updates
> > as impossible, but on second look it could be done. Suppose RESTART
> > IDENTITY does this for each sequence;
> >
> > * obtain AccessExclusiveLock;
> > * assign a new relfilenode;
> > * insert a sequence row with all parameters copied except
> > last_value copies start_value;
> > * hold AccessExclusiveLock till commit.
>
> Hmm, this kills the idea of moving sequence data to a single
> non-transactional catalog :-(
>
> > So what I think we should do is leave the patch there, revise the
> > warning per Neil's complaint, and add a TODO item to reimplement RESTART
> > IDENTITY transactionally.
>
> I think the TODO item did not make it, but the docs do seem updated.

Done:

* Fix TRUNCATE ... RESTART IDENTITY so its affect on sequences is rolled
back on transaction abort

--
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 Bruce Momjian 2008-07-01 18:11:16 Re: Access to localized_str_tolower()
Previous Message Magnus Hagander 2008-07-01 18:06:00 Re: Fairly serious bug induced by latest guc enum changes

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2008-07-01 21:49:13 Re: LOCK_DEBUG documentation
Previous Message Bruce Momjian 2008-07-01 15:20:43 Re: [HACKERS] odd output in restore mode