Antw: Rollback & Nextval fails - Mailing list pgsql-sql

From Gerhard Dieringer
Subject Antw: Rollback & Nextval fails
Date
Msg-id s9325817.046@kopo001
Whole thread Raw
List pgsql-sql
Fredrik Eriksson wrote:

> I have been trying the following SQL code :

> BEGIN;
> INSERT INTO table VALUES ( NEXTVAL('serial'), 'Data' );
> ROLLBACK;

> And the insert function is rolled back but the serial sequence isn't. Hav I
> misunderstood the functionality of rollback or is this a bug? Is there
> someway to get the functionality that rollsback everything?

It's not a bug but a feature. 
Sequence numbers exist to create unique entity-id-number with (usually) no external meaning, so 
1.) there is no need to roll them back
2.) the system would have to keep a list, what sequence number were rolled back.

Gerhard




pgsql-sql by date:

Previous
From: "Eriksson, Fredrik"
Date:
Subject: Rollback & Nextval fails
Next
From: Grant Finnemore
Date:
Subject: Re: Rollback & Nextval fails