> On 20 Aug 2014, at 20:02, Rafael Henrique da Silva Correia 
> <rafaelhenr...@gmail.com> wrote:
> 
> Hi !
> 
> I have a block of code similar to this I made to test:
> 
> def TEST():
>     teste = Test(descricao=str('wololo'))
> 
>     try:
>         db.session.add(wololo)
>         db.session.commit()
>         db.session.close()
>     except IntegrityError, e:
>         db.session.rollback()
>         db.session.close()
>         print e.message
> 
> [..]
> I dont receive any error BUUUTT my sequence increases even in a case except


That’s just how PostgreSQL works. From the PostgreSQL documentation:

Important: To avoid blocking concurrent transactions that obtain numbers from 
the same sequence, a nextval operation is never rolled back; that is, once a 
value has been fetched it is considered used, even if the transaction that did 
the nextval later aborts. This means that aborted transactions might leave 
unused "holes" in the sequence of assigned values.

Wichert.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to