Re: Noob question: how to auto-increment index field on INSERT?

From: davemac <david(at)metadigm(dot)com(dot)au>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Noob question: how to auto-increment index field on INSERT?
Date: 2011-02-23 10:22:38
Message-ID: 1298456558145-3396818.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


This could be due to the sequence being out of sync with the table itself.
Postgres uses the sequence to work out the id value to use for the new row.
The sequence should be the value of the id of the last row inserted in the
table. If the value of the sequence + 1 already exists in the table then you
will get this error. This all works by magic in Django provided the table
and the sequence match.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Noob-question-how-to-auto-increment-index-field-on-INSERT-tp2141875p3396818.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Mark Johnson 2011-02-23 20:41:50 PostgreSQL 9.0.3 on RHEL 5.6?
Previous Message Craig Barnes 2011-02-22 20:22:56 Simple table creation