Re: Last ID Problem

From: <operationsengineer1(at)yahoo(dot)com>
To: Mitch Pirtle <mitch(dot)pirtle(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Last ID Problem
Date: 2005-02-09 16:37:48
Message-ID: 20050209163748.46506.qmail@web52409.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Fuhr 2005-02-09 16:52:56 Re: Last ID Problem
Previous Message operationsengineer1 2005-02-09 16:22:08 Re: Last ID Problem

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-02-09 16:52:56 Re: Last ID Problem
Previous Message operationsengineer1 2005-02-09 16:22:08 Re: Last ID Problem