I'm trying to use
SELECT currval('myTable_Orderid_seq');
I got error: currval not supported.
Any work around this is much appreciated. I need to use currval for each users' session in a multi user environment.
If currval is not available (yet) in the session you can do this:
select last_value from myTable_Orderid_seq
From the doc: http://www.postgresql.org/docs/current/static/sql-createsequence.html
Although you cannot update a sequence directly, you can use a query like:
SELECT * FROM name;
to examine the parameters and current state of a sequence. In particular, the last_value field of the sequence shows the last value allocated by any session. (Of course, this value might be obsolete by the time it's printed, if other sessions are actively doing nextval calls.)
currval()if you callednextval()before that. And please upgrade to a supported version now - a_horse_with_no_namecurrval()before you callnextval()in the same session - a_horse_with_no_name