Re: sequence integrity insite begin-commit? - Mailing list pgsql-novice

From Rob Brown-Bayliss
Subject Re: sequence integrity insite begin-commit?
Date
Msg-id 990656235.1454.0.camel@ZOOstation.cc
Whole thread Raw
Responses Re: Re: sequence integrity insite begin-commit?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
On 03 May 2001 01:00:14 +1200, Rob Brown-Bayliss wrote:
> Hi.  I am develeoping an app with python that uses postgresql.
> I have hit a snag in that I need to know the value of a sequence from an
> insert just performed, but the interface from python to postgres (called
> PoPy) does not return the oid from the insert as psql does.
>
> So what I am doing is begining a transaction, inserting the data,
> selecting the last_value from the sequence and then commiting the
> transaction.
>
> I ma not sure if this will work in the real world as what happens if
> between one user inserting their data if another insets data as well?
> will the last_value from the sewuence (inside the transaction) be
> correct, or will it show the valu for the second user?
>
> Am I being clear? try this
>
>     USER ONE     |     USER TWO
>     ===========================
>     Begin        | Begin
>     Insert       | Insert
>     Select       | Select
>     Commit       | Commit
>
> If these two are happening at the same time (or as near as is possible
> can I rely on the selected last_value being the sequence value that was
> inserted by the user?  (the sequence is the default falue for a column
> and user does not enter it)
>
>
> Thanks
>
> --
>
>   Rob Brown-Bayliss
>  ---======o======---
>   www.ZOOstation.cc

--

  Rob Brown-Bayliss
 ---======o======---
  www.ZOOstation.cc

pgsql-novice by date:

Previous
From: Rob Brown-Bayliss
Date:
Subject: IGNORE-Mail relay test
Next
From: Tom Lane
Date:
Subject: Re: Re: sequence integrity insite begin-commit?