From: | Yvon Thoraval <yvon(dot)thoraval(at)gmail(dot)com> |
---|---|
To: | Chris Angelico <rosuav(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: problem with serial |
Date: | 2012-04-19 15:21:23 |
Message-ID: | CAG6bkBwQ76bsY82g87o-5tR7ht561Te3LO6CvGamh-n9_YZVZg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
2012/4/19 Chris Angelico <rosuav(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Colson | 2012-04-19 15:22:23 | Re: Performance degrades until dump/restore |
Previous Message | Adrian Klaver | 2012-04-19 15:20:04 | Re: problem with serial |