Re: [HACKERS] TRUNCATE TABLE with IDENTITY

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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: [HACKERS] TRUNCATE TABLE with IDENTITY
Date: 2008-06-08 00:30:50
Message-ID: 20080608003050.GU16502@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-06-08 03:06:03 Re: TODO, FAQs to Wiki?
Previous Message Mark Kirkwood 2008-06-08 00:05:34 Re: math error or rounding problem Money type

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-06-08 16:26:06 Re: [HACKERS] TRUNCATE TABLE with IDENTITY
Previous Message Tom Lane 2008-06-06 23:25:40 Patch for dependency traversal during DROP