Re: stored procs

From: John R Pierce <pierce(at)hogranch(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: stored procs
Date: 2011-09-30 08:23:32
Message-ID: 4E857C84.8060306@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2011-09-30 08:28:27 Re: stored procs
Previous Message John R Pierce 2011-09-30 08:04:49 Re: stored procs / data types