Re: [GENERAL] Buggered Sequence - Mailing list pgsql-general

From Ross J. Reedstrom
Subject Re: [GENERAL] Buggered Sequence
Date
Msg-id 19991204160848.B19842@rice.edu
Whole thread Raw
In response to Re: [GENERAL] Buggered Sequence  (Jesse Kipp <jesse@revbox.com>)
Responses Re: [GENERAL] Buggered Sequence  ("Jason C. Wells" <jcwells@u.washington.edu>)
List pgsql-general
Jason -
Jesse's sugestion should work, but there's a setval() function for
this exact use:

SELECT setval('people_id_seq',44);

I usually use it like this:

SELECT setval('"Experiments_ExptID_seq"',max("ExptID")) from "Experiments";

That automatically sets the sequence value to the current max in the table.

Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St.,  Houston, TX 77005

pgsql-general by date:

Previous
From: Jesse Kipp
Date:
Subject: Re: [GENERAL] Buggered Sequence
Next
From: Peter Eisentraut
Date:
Subject: Re: [GENERAL] PostgreSQL 6.5.3 on SuSE 6.1