From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Cindy <ctmoore(at)uci(dot)edu> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: going crazy with serial type |
Date: | 2002-01-31 21:11:18 |
Message-ID: | 5327.1012511478@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Cindy <ctmoore(at)uci(dot)edu> writes:
> OK, next question. I'm trying to use nextval/currval and I'm getting
> this:
> search_info=# select currval('state_vectors_id_seq');
> ERROR: state_vectors_id_seq.currval is not yet defined in this session
currval is defined to return the value most recently returned by nextval
in the current session. Thus, without a prior nextval, you get an error.
The reason for this is to make it useful in a situation where multiple
clients are concurrently obtaining values from the same sequence.
The 7.2 documentation set has been improved (or at least I'd like to
think so) over 7.1's description of sequence stuff. You may find that
reading
http://developer.postgresql.org/docs/postgres/datatype.html#DATATYPE-SERIAL
http://developer.postgresql.org/docs/postgres/functions-sequence.html
http://developer.postgresql.org/docs/postgres/sql-createsequence.html
reduces your level of confusion. (Or not, but at least we tried...)
Note that 7.1 does not have the int8-based sequences described there,
but other than that I believe all the info carries back to 7.1.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Fran Fabrizio | 2002-01-31 21:13:31 | Re: going crazy with serial type |
Previous Message | Stephan Szabo | 2002-01-31 21:06:27 | Re: going crazy with serial type |