Re: problem with serial - Mailing list pgsql-general

From Yvon Thoraval
Subject Re: problem with serial
Date
Msg-id CAG6bkBwQ76bsY82g87o-5tR7ht561Te3LO6CvGamh-n9_YZVZg@mail.gmail.com
Whole thread Raw
In response to Re: problem with serial  (Chris Angelico <rosuav@gmail.com>)
List pgsql-general


2012/4/19 Chris Angelico <rosuav@gmail.com>

If all your inserts make use of the sequence, and you never alter the
sequence, then this should never happen (unless, that is, 34 other
inserts happened between when you inserted and when you checked the
max). Be extremely careful of selecting max(rowid) when you have
concurrent transactions; it's entirely possible that some other
transaction has consumed a value from the sequence but hasn't yet
written it to the database (at least, not in any way that your
transaction can see), which means you risk resetting the sequence too
low.

ChrisA

May be it was an artefact because i was using the same database from command line and thru php ?
because, right now, i do only :
INSERT ...  RETURNING rowid;
and it works well from php...
i did quit the command line by "\q" in between...


--
Yvon


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: problem with serial
Next
From: Andy Colson
Date:
Subject: Re: Performance degrades until dump/restore