Re: problem with serial

Поиск
Список
Период
Сортировка
От Yvon Thoraval
Тема Re: problem with serial
Дата
Msg-id CAG6bkBwQ76bsY82g87o-5tR7ht561Te3LO6CvGamh-n9_YZVZg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: problem with serial  (Chris Angelico <rosuav@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: problem with serial
Следующее
От: Andy Colson
Дата:
Сообщение: Re: Performance degrades until dump/restore