Martijn van Oosterhout wrote:
On Thu, Sep 07, 2006 at 07:15:43AM -0400, Arturo Perez wrote:
iht=> select max(article_id) from article;
max
------
4992
(1 row)

iht=> select nextval('pk_article');
nextval
---------
    4986
(1 row)

Assuming the sequence number is being used correctly why would they be 6 apart?

The last four transactions could be rolled back, or not committed yet.

Could you elaborate on that? I'm confused...

AFAIK after the sequence was initialised at max(article_id), nextval(article_id) could never return a number that's lower than max(article_id).

Unless:
a) the OP managed to query max(article_id) and nextval(article_id) from different transactions, the one querying nextval being older than the one querying max. b) the OP inserted numbers not coming from the sequence; he shot his own feet.
  c) the sequence wrapped around due to reaching numbers exceeding 2^32.

Or are you short on caffeine perhaps? ;)

Regards,
--
Alban Hertroys
[EMAIL PROTECTED]

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

// Integrate Your World //

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to