I want to allocate a contiguous block of ID's from a sequence generator.
My concern is that between the time I call
nextval() to get the start of the block and setval() to set a new
starting seqence number past the end of the block that some parallel
computation may already have called nexval() and allocated something
within my block, or setval().
How can I execute a nextval(),setval() pair under synchronized control?
The only thing I can thing of is
SELECT setval('foo', nextval()+20) ...
Is there any guarantee that the two functions will act under the control
of a synchronized whole in the server executation environment?
Sometimes it's important to be able to obtain a contiguous block of IDs
to avoid fragmenting other tables that express multiple receords for
discontiguous record sequences.
Thanks...