Home > Archive > PostgreSQL Bugs > March 2005 > sequences and rollback









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sequences and rollback
Rick Roman

2005-03-31, 8:04 pm

Do I understand correctly that you cannot roll back sequences?

JDBC example:

connect();
db. setAutoCommit(false)
;
Statement stmt=db.createStatement();
stmt.executeQuery("select nextval('test_seq')");
... other table updates ...
stmt.close();
db.rollback();
db.close();

In this example, the sequence does not roll back. .. other table updates
.... do roll back.


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Michael Fuhr

2005-03-31, 8:04 pm

On Thu, Mar 31, 2005 at 11:18:19AM -0800, Rick Roman wrote:
>
> Do I understand correctly that you cannot roll back sequences?


Correct. This is mentioned in the documentation and in the FAQ.

http://www.postgresql.org/docs/8.0/...s-sequence.html
http://www.postgresql.org/docs/faqs.FAQ.html#4.11.4

You can manually set a sequence's value with setval() or ALTER
SEQUENCE, but that's not the same as rolling back values that you
didn't use.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql
.org

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com