Re: Insert unique fails, still increments ID in a lookup table

From: Chris <dmagick(at)gmail(dot)com>
To: Mark Felegyhazi <m_felegyhazi(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Insert unique fails, still increments ID in a lookup table
Date: 2009-09-22 07:27:11
Message-ID: 4AB87C4F.8010800@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> The problem is that the uniqueness check apparently increases the serial counter and hence I burn through the bigint IDs much faster. It's a waste for 100m+ records...

It's a little hidden but

http://www.postgresql.org/docs/current/static/functions-sequence.html

Per the last sentence, updates to the sequence are never rolled back -
the insert is always going to increment the id regardless of whether it
hits the exception or not.

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message agostonbejo 2009-09-22 10:10:13 How to have ant's <sql> task insert special chars appropriately?
Previous Message David Spadea 2009-09-22 00:27:40 Re: 8.4 installer