On 06/05/2019 12:10, Arup Rakshit wrote:
Hi,
Thanks for your reply. It is automatic, my app don’t creates ID, it
delegates it to the DB. I am using Ruby on Rails app, where we use
Postgresql.
Well, I'm only throwing out wild guesses, but another possibility is
that rows were loaded manually into that table which had different
values for the id column; this would lead to what you see.
Anyway, I'd fix the sequence value first with setval(), and then observe
for a while; if you're still getting id collisions, then something is
definitely inserting id values independently of the sequence. Remember,
the sequence is only used as a default for that column; if you insert a
value into the column, the sequence isn't used and so its current value
doesn't change.
Ray.
--
Raymond O'Donnell // Galway // Ireland
r...@rodonnell.ie