On 09/30/11 1:13 AM, J.V. wrote:
> thanks for the help, we have a production schema with 80 tables and a
> few of the tables have consumed the max limit for the id field, so I
> have to write a program (stored functions would be the fastest way to
> do this), that will go and drop the sequence, create & start at 1
> again, and re-sequence every table and then make sure all the foreign
> keys in every table point to where they are supposed to.
you shouldn't have to drop the sequence, just
setval('sequencename',max(idfield)+1); after resequencing the ID's with
a generate_series... ...
or, convert the fields to bigint which are 64 bit and not likely to wrap
around any time in this century.... (sequences already use bigint)
--
john r pierce N 37, W 122
santa cruz ca mid-left coast