Re: stored procs - Mailing list pgsql-general

From John R Pierce
Subject Re: stored procs
Date
Msg-id 4E857C84.8060306@hogranch.com
Whole thread Raw
In response to stored procs  ("J.V." <jvsrvcs@gmail.com>)
Responses Re: stored procs  (John R Pierce <pierce@hogranch.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: stored procs / data types
Next
From: John R Pierce
Date:
Subject: Re: stored procs