Re: Serials. - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Serials.
Date
Msg-id Pine.LNX.4.30.0103241526220.2319-100000@peter.localdomain
Whole thread Raw
In response to Serials.  (Grant <grant@conprojan.com.au>)
List pgsql-sql
Grant writes:

> (1) Why is a sequence limited to 2147483647, it seems very small?

Because that's what a four-byte signed integer takes.  No one has stepped
forward to implement 8-byte sequence counters, yet.

> (2) If I reset the sequence, then try another insert. It will not insert
> anything until it cycles through all sequences and finds an unused one. It
> will give the following error each time it tries to insert a row with a
> used sequence:
>
> PostgreSQL query failed: ERROR: Cannot insert a duplicate key into unique
> index releases_pkey

Why did you reset the sequence in the first place?  You should probably
set it back to where it was (using setval()).  Sequences simply return
incrementing numbers, they don't fill holes or have any
constraint-avoiding logic.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



pgsql-sql by date:

Previous
From: Mathijs Brands
Date:
Subject: Re: Serials.
Next
From: Andrew Perrin
Date:
Subject: all views in database broken at once