From: | "Gregory Wood" <gregw(at)com-stock(dot)com> |
---|---|
To: | <marie(dot)tuite(at)edisonaffiliates(dot)com>, "Doug McNaught" <doug(at)mcnaught(dot)org>, "Roderick A(dot) Anderson" <raanders(at)acm(dot)org> |
Cc: | "Bruno Wolff III" <bruno(at)wolff(dot)to>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: [Q] Sequences, last_value and inserts |
Date: | 2002-11-01 20:48:05 |
Message-ID: | 01f101c281e7$fbf65ad0$7889ffcc@comstock.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> select last_value from domain_info_tbl_key_seq;
>
> This returns the same value as currval.
In most cases, yes. However:
"Also, last_value will reflect the latest value reserved by any backend,
whether or not it has yet been returned by nextval."
http://www.postgresql.org/idocs/index.php?sql-createsequence.html
It is possible that someone else has changed the sequence value before you
read it, meaning you will not get the value you just inserted (like you
would with currval), but the value of the *other* insert.
This is precisely the problem that the original question was posed to avoid.
Greg
From | Date | Subject | |
---|---|---|---|
Next Message | Booth, Robert | 2002-11-01 20:51:16 | Re: Update FROM clause? |
Previous Message | Marie G. Tuite | 2002-11-01 20:32:56 | Re: [Q] Sequences, last_value and inserts |