Search Postgresql Archives

sequence rollback?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux