Re: TRUNCATE TABLE with IDENTITY

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: TRUNCATE TABLE with IDENTITY
Date: 2008-03-25 16:18:50
Message-ID: 1206461930.4285.964.camel@ebony.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Tue, 2008-03-25 at 09:08 -0700, Steve Crawford wrote:
> Simon Riggs wrote:
> > RESTART IDENTITY will reset the SERIAL sequences back to the original
> > start value.
> >
> Assuming this feature were to be added....
>
> In cases where the same sequence has been used across multiple tables,
> what will be the appropriate response when a user attempts to TRUNCATE
> one of those tables with RESTART IDENTITY?

Well, I'm suggesting it as a TODO item, based on the standard. It would
be for whoever took this up to unravel that.

Since that's a weak answer, I'd say it should only reset sequences that
have been placed there automatically through the use of SERIAL or
BIGSERIAL datatypes.

--
Simon Riggs
2ndQuadrant http://www.2ndQuadrant.com

PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-03-25 16:23:46 partial dump of patch queue to wiki
Previous Message Dimitri Fontaine 2008-03-25 16:12:23 GiST opclass and varlena

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-03-25 16:34:43 Re: Text <-> C string
Previous Message Steve Crawford 2008-03-25 16:08:40 Re: TRUNCATE TABLE with IDENTITY