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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to