pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedWhere is the sequence value?
2+ messages / 2 participants
[nested] [flat]
* Where is the sequence value?
@ 2003-04-19 11:50 Edipo E. F. Melo <edipoelder@ig.com.br>
0 siblings, 1 reply; 2+ messages in thread
From: Edipo E. F. Melo @ 2003-04-19 11:50 UTC (permalink / raw)
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>; pgsql-sql
Hi all,
In my system, I use a sequence to enumerate a proccess list, and this sequence must be reseted each
year. I don't remember how it was created, but when I try to "setval('seq', 0)" I get a "out of bounds
(1, ...) error.
So, I set i to 1 ("setval('seq', 1)"), but in my system, when I try to insert a process, the nextval
() returns 2, not 1.
I was thinking to fix this dropping, e creating the sequence, but in my system, a lot o users have
permission to update the sequence (to use a nextval() on it), and I couldn't revoke they rights when I
drop it.
Insted, I search the docs about where sequence is definited, its min, max and current value, to
change the min value, setting it to 0, but I didn't found something.
(After a lot of text), my question is: how can I change the min value of a sequence without dropping
it?
Thanks for all,
[]'s
Edipo Elder F. de Melo
[edipoelder@ig.com.br]
[ ICQ#: 4546070 ]
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Where is the sequence value?
@ 2003-04-19 15:51 Tom Lane <tgl@sss.pgh.pa.us>
parent: Edipo E. F. Melo <edipoelder@ig.com.br>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2003-04-19 15:51 UTC (permalink / raw)
To: Edipo E. F. Melo <edipoelder@ig.com.br>; +Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>; pgsql-sql
"Edipo E. F. Melo" <edipoelder@ig.com.br> writes:
> So, I set i to 1 ("setval('seq', 1)"), but in my system, when I try to insert a process, the nextval
> () returns 2, not 1.
You need to clear the is_called flag too. See the three-parameter form
of setval():
http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/functions-sequence.html
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-04-19 15:51 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-04-19 11:50 Where is the sequence value? Edipo E. F. Melo <edipoelder@ig.com.br>
2003-04-19 15:51 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox