sequence rollback? - Mailing list pgsql-general

From stig erikson
Subject sequence rollback?
Date
Msg-id do3mj2$ein$1@floppy.pyrenet.fr
Whole thread Raw
Responses Re: sequence rollback?
List 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

pgsql-general by date:

Previous
From: Francisco Reyes
Date:
Subject: One DB not backed up by pg_dumpall
Next
From: David Ang
Date:
Subject: installing tsearch 2 error no user "root"