It's like this. ;-)
I have a table with a column that has a default nextval('sequence').
The sequence is a standard increment 1 cycle sequence.
What happens when
the sequence wraps after inserting the
some of the earlier
rows (say, 1-100) are still in the table
but other rows or sections (say, 101-110 and 120-125) have
and I need to begin with the first un-used sequence number?
I suppose that I would need to find the first un-used sequence number,
use setval() to update the sequence, and then insert the row that needs
to be insert-ed. Well, how can I find the first un-used sequence number?
I thought about doing something using a function like
select sequence_column from table
NOT [the set of numbers that make up the sequence]
but, how do I select the set of numbers that make up the sequence?
Is there a better/cleaner/easier way of getting the end result?
Postgres 7.0.2 (should be running .3, *sigh*)
Thanks fellas (and ladies, if applicable).
pgsql-novice by date
|Next:||From: Paul McGarry||Date: 2000-11-24 04:17:59|
|Subject: Re: re : PHP and persistent connections|
|Previous:||From: Alfred Perlstein||Date: 2000-11-23 19:31:53|
|Subject: Re: startup script for FreeBSD|
pgsql-general by date
|Next:||From: Peter Eisentraut||Date: 2000-11-23 20:13:09|
|Subject: Re: pgaccess|
|Previous:||From: Jose Manuel Lorenzo Lopez||Date: 2000-11-23 18:24:03|
|Subject: Compiling postgresql 7.0.3 for WinNT|