currval was (Re: Re: Re: is PG able to handle a >500 GB Database? ) - Mailing list pgsql-general

From rob
Subject currval was (Re: Re: Re: is PG able to handle a >500 GB Database? )
Date
Msg-id 000a01c08300$bbb60200$4100fd0a@cabrion.org
Whole thread Raw
In response to Re: Re: is PG able to handle a >500 GB Database?  ("Oliver Elphick" <olly@lfix.co.uk>)
Responses Re: currval was (Re: Re: Re: is PG able to handle a >500 GB Database? )  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I use for sequences for row versioning not just numbering.  I'm glad you
pointed this out.  I'll need to revisit that code.

Is there a correct way to "initialize" currval without incrementing the
sequence?

--rob


----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "rob" <rob@cabrion.com>
Cc: "Florent Guillaume" <efgeor@noos.fr>; "Oliver Elphick"
<olly@lfix.co.uk>; <pgsql-general@postgresql.org>
Sent: Saturday, January 20, 2001 11:22 AM
Subject: Re: [GENERAL] Re: Re: is PG able to handle a >500 GB Database?


> "rob" <rob@cabrion.com> writes:
> > currval returns error unless nextval has been called at least once in
the
> > session.
>
> > I use <seq>.last_value
>
> > Perhaps I'm fooling myself
>
> Yes, you are, unless you never have more than one client attached to
> your database.  last_value will return whatever value was last assigned
> by any backend, therefore you might not get the value that was inserted
> into your tuple, but someone else's.
>
> The point about currval being initially undefined seems moot if what
> you're using it for is to recover the serial number that was assigned to
> a tuple you just inserted ...
>
> regards, tom lane
>


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: Re: is PG able to handle a >500 GB Database?
Next
From: Tom Lane
Date:
Subject: Re: currval was (Re: Re: Re: is PG able to handle a >500 GB Database? )