From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | operationsengineer1(at)yahoo(dot)com |
Cc: | Mitch Pirtle <mitch(dot)pirtle(at)gmail(dot)com>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Last ID Problem |
Date: | 2005-05-04 16:56:26 |
Message-ID: | 20050504165626.GB30968@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
On Wed, May 04, 2005 at 09:21:52 -0700,
operationsengineer1(at)yahoo(dot)com wrote:
> > Why not first get the current value from the
> > sequence, use it for your
> > INSERT statement, and then have it handy for the
> > rest of the script?
>
> i hate to revisit this old topic, however, i just want
> to make sure i'm avoiding future problems.
>
> if i pull nextval then insert it into the id column
> where i pulled it from, will the counter ever get "off
> track" since i'm doing manual inserts?
What do you mean by off track? nextval will return a unique value each
time it is called. If you want to refer to the last value returned by
nextval in the same session, you should use currval.
> can nextval ever become a value that's unexpected? in
> practice, this method is working very well, but i'm
> paranoid. ;-)
When you reach the maximum value for the sequence then you will get an
error. The default maximum value for 8.0 appears to be 9223372036854775807.
If you store the value in a 4 byte integer, then you will have problems
sooner.
From | Date | Subject | |
---|---|---|---|
Next Message | sZEJTAN | 2005-05-04 18:57:26 | date update check |
Previous Message | operationsengineer1 | 2005-05-04 16:21:52 | Re: Last ID Problem |