Re: [HACKERS] TRUNCATE TABLE with IDENTITY - Mailing list pgsql-patches

From Alvaro Herrera
Subject Re: [HACKERS] TRUNCATE TABLE with IDENTITY
Date
Msg-id 20080608003050.GU16502@alvh.no-ip.org
Whole thread Raw
In response to Re: [HACKERS] TRUNCATE TABLE with IDENTITY  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] TRUNCATE TABLE with IDENTITY  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] TRUNCATE TABLE with IDENTITY  (Bruce Momjian <bruce@momjian.us>)
List 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

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Patch for dependency traversal during DROP
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] TRUNCATE TABLE with IDENTITY