reinitialize a sequence?

From: Bruno Boettcher <bboett(at)erm1(dot)u-strasbg(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: reinitialize a sequence?
Date: 2000-12-04 23:30:34
Message-ID: 20001205003034.D31987@erm1.u-strasbg.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

hello,
played a bit around with the serial type....
wanted to adapt my already existing tables to this system...
dumped the DB, created the new tables, loaded old data in....

all works, until i try to insert something without specifying the id
field (that's the now sequential field). And the reason is that the
sequene is set to 1.....

is there a simple way to tell all sequences to take the max value +1 of
their respective tables? (a bit like the vacuum command?)

i tryed to set the value by hand, but did something wrong :D the command
didn't completed:
fibu=> update journal_id_seq set last_value=1187;
ERROR: You can't change sequence relation journal_id_seq

surely something real stupid again, but i never used sequences till
now... and there's no example in the docu.... (BTW would be nice if this
was addressed in the documentation)

--
ciao bboett
==============================================================
bboett(at)earthling(dot)net
http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett
===============================================================
the total amount of intelligence on earth is constant.
human population is growing....

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Dan Lyke 2000-12-04 23:51:35 reinitialize a sequence?
Previous Message Joel Burton 2000-12-04 20:27:34 Re: [SQL] Access Permissions/Security