Re: [GENERAL] Help with seq numbers...

2005-02-14 Thread javier wilson
On Mon, 14 Feb 2005 15:47:06 -0600, Cristian Prieto <[EMAIL PROTECTED]> wrote: > > why don't you use a serial? that way you don't have to insert it? i > > usually let postgresql take care of it, and you can use currval to > > return a value. > > That's the trouble, I need a sp that returns the use

Re: [GENERAL] Help with seq numbers...

2005-02-14 Thread Bruno Wolff III
On Mon, Feb 14, 2005 at 15:12:56 -0600, Cristian Prieto <[EMAIL PROTECTED]> wrote: > > And it is working fine, but when I get a Unique_Violation (cuz there is a > iduser already) the sequence still advance to the next value. There is any > way to rollback or avoid holes in the sequence? I've r

Re: [GENERAL] Help with seq numbers...

2005-02-14 Thread Thomas F . O'Connell
The manual is correct. There is no way to roll back a nextval. There are a variety of workarounds suggested in the archives. Take a look. One example is precalculating a large sequence and storing it in a table. -tfo -- Thomas F. O'Connell Co-Founder, Information Architect Sitening, LLC htt

[GENERAL] Help with seq numbers...

2005-02-14 Thread Cristian Prieto
Hello, thanks a lot for your help and sorry for my newbie questions...   I have the following SP: It is indexed by iduser (a primary key)   CREATE FUNCTION store_users(name varchar, lastname varchar) RETURNS integer AS $body$ DECLARE     userid INTEGER := nextval('this_is_a_sequence'); BEGIN