Re: Last ID Problem - Mailing list pgsql-novice

From
Subject Re: Last ID Problem
Date
Msg-id 20050209163748.46506.qmail@web52409.mail.yahoo.com
Whole thread Raw
In response to Re: Last ID Problem  (<operationsengineer1@yahoo.com>)
Responses Re: Last ID Problem
List pgsql-novice
> mitch and all, i noticed that if i keep refreshing
> my
> page that the $insert_id keeps growing...  66 then
> 67
> then 68 then 69.
>
> i guess this makes sense, after all, the "next
> value"
> is always and icnrement higher.  this makes me a
> little nervous, though.
>
> i only want one value...  the next id i should use
> to
> perform an insert.
>
> i'm hoping currval() does the trick, however, i'm
> getting no result.
>
> do i need to instruct the sequence to go to it last
> value before calling currval()?
>
> tia...

another point of interest.  now that i've been
refreshing my nextval() statement, my highest cust_id
value is 65, but nextval() keeps incrementing from
where it was before.  reading through the manual, this
is designed in behavior.

it looks like i could reset the value using setval().

i also noticed that currval() returns the value of the
last nextval().  this infers that i must call
nextval() prior to being able to get currval(), yet
nextval() was not included in the original suggestion.

am i missing something here?

tia...

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

pgsql-novice by date:

Previous
From:
Date:
Subject: Re: Last ID Problem
Next
From: Michael Fuhr
Date:
Subject: Re: Last ID Problem