Re: TRUNCATE TABLE with IDENTITY - Mailing list pgsql-hackers

From Decibel!
Subject Re: TRUNCATE TABLE with IDENTITY
Date
Msg-id 207EDE13-F000-4090-8FC6-77560736B60D@decibel.org
Whole thread Raw
In response to Re: TRUNCATE TABLE with IDENTITY  (Zoltan Boszormenyi <zb@cybertec.at>)
Responses Re: TRUNCATE TABLE with IDENTITY  (Zoltan Boszormenyi <zb@cybertec.at>)
List pgsql-hackers
On Mar 25, 2008, at 11:40 AM, Zoltan Boszormenyi wrote:
> All of them? PostgreSQL allow multiple SERIALs to be present,
> the standard allows only one IDENTITY column in a table.
> And what about this case below?
>
> CREATE TABLE t1 (id1 serial, ...);
> ALTER SEQUENCE seq_t1_id1 RESTART WITH 5432 CYCLE;
>
> or the equivalent
>
> CREATE SEQUENCE seq_t1_id1 START WITH 5432 CYCLE;
> CREATE TABLE t1 (id1 serial, ...);
> ALTER SEQUENCE seq_t1_id1 OWNED BY t1.id1;
>
> PostgreSQL doesn't keep the START WITH information.
> But it should to perform a "restart" on the sequence,
> using the minval in this case wouldn't be correct.


I think you misunderstand what ALTER SEQUENCE RESTART does; it only  
changes the current value of the sequence.
-- 
Decibel!, aka Jim C. Nasby, Database Architect  decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828



pgsql-hackers by date:

Previous
From: Decibel!
Date:
Subject: Re: Proposal: new ereport option "errdetail_log"
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] SHA1 on postgres 8.3