sequence rollback?

From: stig erikson <stigerikson_nospam_(at)yahoo(dot)se>
To: pgsql-general(at)postgresql(dot)org
Subject: sequence rollback?
Date: 2005-12-18 13:02:49
Message-ID: do3mj2$ein$1@floppy.pyrenet.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hello.
is it possible to rollback sequences in postgresql 8.1.1?
(tested om FC4 with official rpms).

it seems like a sequence is always moving forward and cannot be rolled
back. is this correct?
if it is correct, where in the docs do i find information about this
behavior?

/stig

testcase:

bash-2.05b$ createdb testseq
CREATE DATABASE

bash-2.05b$ psql -d testseq
Welcome to psql 8.1.1, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

testseq=# create sequence test_seq increment 1 minvalue 1;
CREATE SEQUENCE
testseq=# create table test0 ( id int8 NOT NULL DEFAULT
nextval('test_seq'), text varchar(20) );
CREATE TABLE
testseq=# begin;
BEGIN
testseq=# insert into test0 (text) values('hello');
INSERT 0 1
testseq=# select * from test0;
id | text
----+-------
1 | hello
(1 row)

testseq=# rollback;
ROLLBACK
testseq=# begin;
BEGIN
testseq=# insert into test0 (text) values('hello');
INSERT 0 1
testseq=# select * from test0;
id | text
----+-------
2 | hello
(1 row)

testseq=# rollback;
ROLLBACK

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2005-12-18 13:55:37 Re: update count
Previous Message Chris Velevitch 2005-12-18 08:50:34 update count